Array in C are one means of aggregating scalar data into larger data types.
For example:
char A[12];
char *B[8];
int C[6];
double *D[5];
Array | Element size | Total size | Start address | Element i |
---|---|---|---|---|
A | 1 | 12 | x | x + i |
B | 8 | 64 | x | x + 8 * i |
C | 4 | 24 | x | x + 4 * i |
D | 8 | 40 | x | x + 8 * i |
Practice:
Pay attention: the array reference A[i]
is identical to the expression *(A+i)
.
Practice:
For an array declared as:
T D[R][C];
Any element of D[i][j]
is at memory address:
Practices: