Open In App
Related Articles

C | Pointer Basics | Question 10

Improve Article
Improve
Save Article
Save
Like Article
Like

The reason for using pointers in a C program 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 pointer 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.


Quiz of this Question
Please comment below if you find anything wrong in the above post

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 05 Feb, 2013
Like Article
Save Article
Previous
Next
Similar Reads