0 day streak
c / beginner
Snippet

Basic Integer Arrays

An array stores multiple values of the same type. You access each element using an index, which always starts at 0 for the first position.

snippet.c
c
1
2
3
4
int list[3];
list[0] = 5;
list[1] = 10;
list[2] = 15;
Breakdown
1
int list[3];
Declares an array named 'list' that can hold 3 integers.
2
list[0] = 5;
Assigns the value 5 to the first position (index 0) of the array.