20 20 10 20
What is application of above?
Consider a situation where we pass a pointer to a function and we want the function to modify the pointer to point to something else and we want these changes to reflect in caller. For example, writing a linked list function that changes head of it, we pass reference to pointer to head so that the function can change the head (An alternative is to return the head). We can also achieve same thing using double pointers.
3 2 1
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.
- Passing Reference to a Pointer in C++
- When do we pass arguments by reference or pointer?
- Different ways to use Const with Reference to a Pointer in C++
- Passing by pointer Vs Passing by Reference in C++
- Return by reference in C++ with Examples
- Double Pointer (Pointer to Pointer) in C
- What is a Pointer to a Null pointer
- stringstream in C++ and its applications
- Applications of Pointers in C/C++
- MakeFile in C++ and its applications
- Why do we need reference variables if we have pointers
- INT_MAX and INT_MIN in C/C++ and Applications
- strchr() function in C++ and its applications
- C++ string class and its applications
- C++ String Class and its Applications | Set 2
- How to add reference of an object in Container Classes
- Can C++ reference member be declared without being initialized with declaration?
- 'this' pointer in C++
- Pointer vs Array in C
- Pointer to an Array | Array Pointer
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.