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.
- Double Pointer (Pointer to Pointer) in C
- When do we pass arguments by reference or pointer?
- Passing by pointer Vs Passing by Reference in C++
- Passing Reference to a Pointer in C++
- Different ways to use Const with Reference to a Pointer in C++
- Pointer to an Array | Array Pointer
- What is a Pointer to a Null pointer
- Return by reference in C++ with Examples
- INT_MAX and INT_MIN in C/C++ and Applications
- Difference between Call by Value and Call by Reference
- C++ string class and its applications
- C++ String Class and its Applications | Set 2
- stringstream in C++ and its applications
- MakeFile in C++ and its applications
- strchr() function in C++ and its applications
- Can C++ reference member be declared without being initialized with declaration?
- How to add reference of an object in Container Classes
- Why do we need reference variables if we have pointers
- Trie Data Structure using smart pointer and OOP in C++
- Difference between pointer and array in C?
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.