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 expressions
(D) Pointers cannot be used to access structure members
Choose the correct answer from the options given below:
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. (A) and (B) Only
Explanation
Pointer arithmetic accesses array elements (A), and a pointer-to-pointer stores another pointer's address (B). Pointers are not dereferenced automatically (you must use * or ->), and they can access structure members via ->.More Programming Languages and Computer Graphics questions
- Consider the function in C code:Cal(a, b) { if (b != 1) { if (a != 1) { printf("*"); Cal(a/2, b); } else { b = b - 1; Cal(10, b); } } } How…
- Which of the following is the correct way to declare a function pointer in C?
- Consider the following C program:#include<stdio.h> int main() { int x[] = {2,4,6,8,10}; int a, b = 0, *y = x + 4; for (a = 0; a < 5; a++) {…
- Which of the following are TRUE about constructors in C++? (A) A constructor can be overloaded. (B) A constructor does not have a return ty…
- What is the output of the following program?#include<stdio.h> void f1(char *x, char *y) { char *t1; t1 = x; x = y; y = t1; } void f2(char *…
- Which of the following C++ statements correctly declares an abstract class?