C Tutorial · Chapter 14 of 16
C Arrays
Store many values of the same type.
An array keeps a list under one name. Indexes usually start at 0.
Use a loop to visit each element.
Array sample
Try it Yourself »
#include <stdio.h>
int main(void) {
int scores[5] = {90, 85, 88, 92, 95};
for (int i = 0; i < 5; i++) {
printf("Score %d: %d\n", i + 1, scores[i]);
}
return 0;
}
Classroom Tips
- Do not access outside the array size.
- 2D arrays use row and column indexes.