how to elements of a list in C
#include <stdio.h>
int main (int argc, char * argv[])
{
int i = 0;
int list[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int run = 1;
int length_of_list; // the number of elements that the list contains
length_of_list = sizeof(list) / sizeof(int); // getting the number
while (run){ //printing the list
printf("The list is: %d\n", list[i]);
i = i + 1;
if (i == length_of_list){ //check if the list has ended
printf("The list has ended!\n");
break; // exit the loop
}
}
return 0;
}