Which of the following statements about pointers in C are TRUE. (A) Pointers…
2024
Which of the following statements about pointers in C are TRUE.
(A) Pointers can be used to access array elements
(B) Pointers can store the address of another pointer
(C) Pointers are automatically dereferenced in expression
(D) Pointers cannot be used to access structure members
Choose the correct answer from the options given below:
- A.
(A) and (C) Only
- B.
(A) and (B) Only
- C.
(B) and (C) Only
- D.
(C) and (D) Only.
Attempted by 202 students.
Show answer & explanation
Correct answer: B
Answer: The true statements are "Pointers can be used to access array elements" and "Pointers can store the address of another pointer".
Pointers can be used to access array elements — True. An array name can decay to a pointer to its first element, and pointer arithmetic plus dereference accesses elements. Example: if arr is an int[], then *(arr + i) and arr[i] both access the i-th element.
Pointers can store the address of another pointer — True. You can have pointers to pointers, e.g., int *p; int **pp = &p; this stores the address of p.
Pointers are automatically dereferenced in expressions — False. Dereferencing must be explicit with the * operator. A related convenience is the -> operator, which combines dereference and member access for pointers to structs, but that is an explicit operator, not automatic dereferencing in arbitrary expressions.
Pointers cannot be used to access structure members — False. You can access members through a pointer to a struct using (*p).member or p->member.
Therefore, the correct selection is the one that includes the two true statements: the ability to access array elements with pointers and the ability for pointers to store the address of another pointer.
A video solution is available for this question — log in and enroll to watch it.