Complete the code to shift all elements left by one to delete the first element.
for(int i = 0; i < n - 1; i++) { arr[i] = arr[[1]]; }
To delete the first element, each element is replaced by the next element, so arr[i] = arr[i + 1].
Complete the code to reduce the array size after deletion.
n = n [1] 1;
After deleting the first element, the size of the array decreases by 1, so n = n - 1.
Fix the error in the loop condition to avoid out-of-bound access.
for(int i = 0; i [1] n - 1; i++) { arr[i] = arr[i + 1]; }
The loop should run while i < n - 1 to avoid accessing arr[n], which is out of bounds.
Fill both blanks to complete the function that deletes the first element of the array.
void deleteFirst(int arr[], int *n) {
for(int i = 0; i [1] *n - 1; i++) {
arr[i] = arr[i [2] 1];
}
(*n)--;
}The loop runs while i < *n - 1, and each element is replaced by the next element arr[i + 1].
Fill all three blanks to print the array after deleting the first element.
for(int i = [1]; i [2] n; i[3]) { printf("%d ", arr[i]); }
After deletion, elements are shifted left and n is decremented, so the remaining elements are at indices 0 to n-1. Use i=0; i < n; i++.
