5.1.arrays
5.1.arrays
Single-Dimensional Arrays
Generic declaration:
typename variablename[size]
– typename is any type
– variablename is any legal variable name
– size is a number the compiler can figure out
– For example
int a[10];
– Defines an array of ints with subscripts ranging from 0 to 9
– There are 10*sizeof(int) bytes of memory reserved for this
array.
a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9]
In memory:
printf("\n");
return 0;
}