#include #define ARRAY_SIZE 10 int main () { int i; /* Initialize all the elements. */ int array_all[ARRAY_SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; /* If only the first elements are initialized, the remaining elements are all set to zero. */ int array_first_two[ARRAY_SIZE] = { 1, 2 }; /* So, if the first element is set to zero, then everything else is, too. */ int array_zero[ARRAY_SIZE] = { 0 }; /* But if nothing is initialized, the whole array contains random junk. */ int array_not_static[ARRAY_SIZE]; /* Unless the array is declared using "static", in which case it is zeroed. */ static int array_static[ARRAY_SIZE]; /* This prints out the contents of the arrays. */ for (i = 0; i < ARRAY_SIZE; i++) { printf ("%2d: %2d %d %d %12d %d\n", i, array_all[i], array_first_two[i], array_zero[i], array_not_static[i], array_static[i] ); } return 0; }