Arrays
Arrays hold items of one type in a row. Indexes start at 0 and C does not check bounds.
Example
#include <stdio.h>
int main(void) {
int a[5] = {10, 20, 30};
int sum = 0;
for (int i = 0; i < 5; i++) sum += a[i];
printf("%d %d %zu\n", a[1], sum, sizeof a / sizeof a[0]);
return 0;
}Result
20 60 5
Exercise
First index.
a[]
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.