An array is an ordered set of data objects of the same type.
Declaration:
int numbers[10]; /* Declare numbers[0] to numbers[9]. */ |
Example:
for (i = 0; i < 10; i++) counts[i] = 0; /* Initialise the array (else garbage). */ |
Example:
int a[4] = {10, 20, 30, 40}; int *pa; printf("%d\n", a[0]); /* print the first element of a*/ pa = &a[0]; printf("%x\n", pa); /* prints the address of the first */ /* element of a */ pa = a; printf("%x\n",pa); /* also prints the address of the */ /* first element of a */ |
...previous | up (conts) | next... |