An array behaves like a list of variables with a uniform naming mechanism that can be declared in a single line of simple code.
Declaring and Referencing ArraysWe will call them indexed variables, though they are also sometimes called subscripted variables or elements of the array. The number in square brackets
In C++, an array consisting of five variables of type int can be declared as follows:
int score[5];
This declaration is like declaring the following five variables to all be of type int:
score[0], score[1], score[2], score[3], score[4]
is called an index or a subscript.
No comments:
Post a Comment