C Arrays
Store a fixed sequence.
On this page
The concept
An array groups values of one type. Its size is fixed and indexing begins at zero. Stay within the declared bounds.
Code example
C
#include <stdio.h>
int main(void) {
int scores[] = {82, 91, 76};
printf("%d\n", scores[1]);
return 0;
}Output
91
Follow the code
Open the walkthrough to inspect the example one step at a time.
Show guided walkthrough
Guided walkthroughReady
1
#include <stdio.h>2
int 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
| Step / line | What happens | State after step | Output so far |
|---|---|---|---|
| Create three consecutive int elements. | scores = {82, 91, 76} | — | |
| Index 1 selects the second element. | scores = {82, 91, 76} | 91 |
Behind the scenes
How C processes this code
The C compiler produces a native program. Variables occupy memory, and execution enters main.