Page t027, go to NEXT,
PREVIOUS, INDEX
Arrays
A collection of elements of same type
float x[100];
- first element of array is x[0]
- last element of array is x[99]
Initializing array elements
float x[3] = {1.1, 2.2, 3.3};
float y[] = {1.1, 2.2, 3.3, 4.4};
- can let the compiler calculate the dimension
Multi-dimensional arrays
float m[4][4];
int m2[2][3] = { {1, 2, 3},
{4, 5, 6} };
- elements appear row-wise
- in other languages elements may appear column-wise
C Course, 21-jan-1997,
Peter Klok,
pfk@hef.kun.nl