Complete the code to declare a pointer to an integer.
int [1] ptr;The asterisk (*) is used to declare a pointer variable in C.
Complete the code to access the first element of the array using a pointer.
int arr[3] = {1, 2, 3}; int *p = arr; int first = [1];
The expression *p dereferences the pointer to get the first element of the array.
Fix the error in the pointer arithmetic to access the third element.
int arr[4] = {10, 20, 30, 40}; int *p = arr; int val = *[1];
Adding 2 to pointer p moves it to the third element, then dereferencing gets its value.
Fill both blanks to create a pointer to the second element and get its value.
int nums[5] = {5, 10, 15, 20, 25}; int *ptr = nums [1] 1; int value = *[2];
Adding 1 to the array name points to the second element. Dereferencing ptr gets its value.
Fill all three blanks to create a pointer, move it, and access the value correctly.
int data[4] = {2, 4, 6, 8}; int *p = [1]; p = p [2] 3; int val = *[3];
Pointer p starts at data, moves forward 3 elements, then dereferenced to get the value.