Complete the code to access the element at index 2 in the array.
int arr[] = {10, 20, 30, 40, 50};
int value = arr[[1]];
printf("%d\n", value);The index 2 accesses the third element in the array, which is 30.
Complete the code to update the element at index 1 to 100.
int arr[] = {5, 10, 15, 20};
arr[[1]] = 100;
printf("%d\n", arr[1]);Index 1 corresponds to the second element, which we update to 100.
Fix the error in the code to correctly update the last element of the array.
int arr[] = {1, 2, 3, 4, 5};
int n = 5;
arr[[1]] = 50;
printf("%d\n", arr[4]);The last element is at index n - 1 because indexing starts at 0.
Fill both blanks to print the updated value at index 3 after setting it to 99.
int arr[] = {7, 8, 9, 10, 11};
arr[[1]] = 99;
printf("%d\n", arr[[2]]);Index 3 is updated to 99 and then printed from the same index.
Fill all three blanks to update the element at index 0 to 42, then print it.
int arr[] = {0, 1, 2, 3};
arr[[1]] = [2];
printf("%d\n", arr[[3]]);We update index 0 to 42 and then print the value at index 0.
