The reason for using pointers in a Cprogram is
(A) Pointers allow different functions to share and modify their local variables.
(B) To pass large structures so that complete copy of the structure can be avoided.
(C) Pointers enable complex “linked” data structures like linked lists and binary trees.
(D) All of the above
Answer: (D)
Explanation: See below explanation
(A) With pointers, address of variables can be passed different functions can use this address to access the variables.
(B) When large structure variables passed or returned, they are copied as everything is passed and returned by value in C. This can be costly with structure containing large data. To avoid this copying of large variables, we generally use poitner for large structures so that only address is copied.
(C) With pointers, we can implement “linked” data structures. Java uses reference variables to implement these data structures. Note that C doesn’t support reference variables.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- C | Pointer Basics | Question 2
- C | Pointer Basics | Question 7
- C | Pointer Basics | Question 4
- C | Pointer Basics | Question 3
- C | Pointer Basics | Question 1
- C | Pointer Basics | Question 11
- C | Pointer Basics | Question 12
- C | Pointer Basics | Question 15
- C | Pointer Basics | Question 17
- C | Pointer Basics | Question 16
- C | Pointer Basics | Question 17
- C | Pointer Basics | Question 17
- C | Pointer Basics | Question 14
- C | Pointer Basics | Question 8
- C | Pointer Basics | Question 6
- C | Pointer Basics | Question 13
- Double Pointer (Pointer to Pointer) in C
- C++ | this pointer | Question 5
- C++ | this pointer | Question 4
- C++ | this pointer | Question 1

