what is array
An array is a collection of elements. We can use array to store some specific number of elements depending on the size of the array.
For example, in C:
int array[10];
creates an array that can store 10 integer values. In C, array is a collection of homogeneous elements. That means it can hold elements of only a specific data type.
In the above example, the array can hold only integer values.
Here, the array index starts from 0 and the index of last element will be 9.
We can assign values in array using assignment operator.
array[0] = 10 assigns 10 as the first element of the array.
Also we can retrieve the stored value using the index value.
array[0] returns 10.
Get Answers For Free
Most questions answered within 1 hours.