Array notation is a form of pointer notation. The name of an array is the beginning address of the array, called the base address of the array.
The array name is referred to as an address constant. Mentioning the name of the array fetches its base address.
An array can be subscripted to get to individual cells of data.
From the above example, it is clear
that &x[0] is equivalent to x. And, x[0] is
equivalent to *x.
Similarly,
- &x[1] is equivalent to x+1 and x[1] is
equivalent to *(x+1).
- &x[2] is equivalent to x+2 and x[2] is
equivalent to *(x+2).
- ...
- Basically, &x[i] is equivalent to x+i and x[i] is equivalent to *(x+i).
For any one-dimensional array a and integer i,
the following relationships are always true.
No comments:
Post a Comment