C Arrays

Store a fixed sequence.

C
#include <stdio.h>
int main(void) {
  int scores[] = {82, 91, 76};
  printf("%d\n", scores[1]);
  return 0;
}
Output
91

Explanation

An array groups values of one type. Its size is fixed and indexing begins at zero. Stay within the declared bounds.

Explore the dry run
Guided walkthroughReady
1#include <stdio.h>
2int main(void) {
3 int scores[] = {82, 91, 76};
4 printf("%d\n", scores[1]);
5 return 0;
6}

Follow the example

Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.

View the complete dry-run table
Prepared trace of the published program. Some rows group repeated iterations.
Step / lineWhat happensState after stepOutput so far
Create three consecutive int elements.scores = {82, 91, 76}
—
Index 1 selects the second element.scores = {82, 91, 76}
91