int my_integer;To define an array of integers looks like this:
int my_array[20];I just declared 20 integers all at once. Just like that! This is a great way to create a whole lot of storage in a small amount of code. Now lets look at how to get at some of those integers...
int my_array[20]; my_array[0] = 5; my_array[6] = 30; my_array[19] = 12; printf("The first element in my array is: %d\n", my_array[0]);One important thing to keep in mind is that the elements of a 20-element array are not numbered 1 to 20, they are numbered 0 to 19. This is just one of the ways computers do things -- they start with 0 instead of 1.
int i; int my_array[20]; for (i=0; i<20; i++) { my_array[i] = 0; }The above code sets all the elements of my_array to 0. Don't forget to set all your variables' values before you read them! There might be garbage in there if you don't. ;)