0
array
Anyone here who help to know array. Give me some tips
1 Answer
+ 3
Here's the jist of it:
An array is a bunch of values.
All of these values must be of the same type.
For example,
int[] array;
// These must all be int's (whole numbers)
Now for some terminology:
Each value in the array is called an element.
array = {5, 3, 2};
// 5, 3, and 2 are elements
Now, think of the distance from the first element as being the elements index.
So, the element at the index of 0 is 5.
(The index is basically the location of each element).
array[1]; // this is 3
array[2] = 5; // replaced 2 with 5