An array is a compound data structure that lets us group together many variable cells, all of the same type, into one unit, giving it one name.
We delcare an array by giving its type, name and size:
int data[100];
char str[81];
Such declaration statements declare(tell the compiler), and define(allocate the memory cells) for these arrays. The memory cells are allocated in one block in adjacent locations in memory:
Each cell has an index - an integer label which can be used to identify and access individual data items in the array (remember, the name refers to the ENTIRE array. We access (read or write) an individual element of an array with a subscripting expression of the form:
<identifier>[<expression>]
where <identifier> is the name of the array, and <expression> is an integer valued expression which evaluates to the index of the element being accessed. For example:
data[35] = 30;
putchar(str[3]);
Remember:
the indexes for the elements of the array range from 0 to size-1.
In C, arrays are really implemented with pointers.
When we declare an array like:
int data[100];
The compiler allocates 100 integer cells in memory...
The Pointer Part
We know we can access integers one by one using data[0], data[1], ... and so on. But just data by itself is a pointer.
data is a pointer to the first element data[0].
so using the dereference operator *data is the same as data[0]
since the memory is allocated sequentially, *(data+1) is the same as data[1] and so on.