0
How to use arrays in c
4 ответов
+ 1
int a[5] = {1,2,3,4,5};
printf("%d\n",a[1]);
//prints 2 as array index starts from 0
0
using the for function
0
for (int i = 0; i < ARRAY_SIZE; ++i)
do_something_with(a[i]);
This will do something with all array members.
0
https://code.sololearn.com/cV2cJ89sVK5d/?ref=app here i made an array, gave it some values in the for loop, and then used for loop to print out those values
also this is my first code in C and not C++, feels weird