c / beginner
Snippet
Basic Array Initialization
An array stores a fixed-size sequential collection of elements of the same type. Indexing starts at 0.
snippet.c
1
2
int scores[5] = {90, 85, 70, 95, 80};int firstScore = scores[0];
Breakdown
1
int scores[5]
Declares an integer array that can hold 5 elements.
2
{90, 85, 70, 95, 80}
Initializes the array with these specific values.
3
scores[0]
Accesses the very first element of the array.