Complete the code to declare an integer array of size 5.
int arr[[1]];The code declares an integer array named arr with 5 elements.
Complete the code to access the third element of the array.
int value = arr[[1]];Array indexes start at 0, so the third element is at index 2.
Fix the error in the loop to print all elements of the array of size 4.
for(int i = 0; i < [1]; i++) { printf("%d\n", arr[i]); }
The loop should run while i is less than the array size, which is 4.
Fill both blanks to create a loop that sums all elements in an array named nums of size 6.
int sum = 0; for(int [1] = 0; [1] < [2]; [1]++) { sum += nums[[1]]; }
Variable i is commonly used as a loop counter. The loop runs while i < 6 to cover all elements.
Fill both blanks to declare an array, initialize it, and print its first element.
[1] arr[3] = {1, 2, 3}; printf("%d\n", [2]);
The array is declared as int arr[3], initialized with values, and the first element arr[0] is printed.
