When you use Visual Basic syntax to define the size of an array, you specify its highest index, not the total number of elements in the array. The indexes of an array range from 0 to one less than the total number of elements in the array. Each new grade that we add requires that the application be modified, recompiled, and redeployed.īy using an array, you can refer to these related values by the same name, and use a number that’s called an index or subscript to identify an individual element based on its position in the array. This in turn makes an application much more likely to have serious bugs. Handling large numbers of grades quickly becomes unwieldy.We have to know at design time exactly how many grades we have to handle.This approach has three major limitations: For example, if our application analyzes student grades, we can use a separate variable for each student's grade, such as englishGrade1, englishGrade2, etc. It is possible to use individual variables to store each of our data items. Similarly, an array may consist of a student's grades for a class each element of the array is a single grade. For example, an array may consist of the number of students in each grade in a grammar school each element of the array is the number of students in a single grade. An array is a set of values, which are termed elements, that are logically related to each other.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |