top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What does **p means in c++, please explain with example?

+1 vote
342 views
What does **p means in c++, please explain with example?
posted Nov 8, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

****p is nothing but a double pointer or pointer to pointer**

Double pointer is used to store the address of a pointer, (Considering that you are familiar with pointer concept, so not explaining about pointer)

What is Pointer to Pointer ?

Double (**)  is used to denote the double Pointer
Pointer Stores the address of the Variable
Double Pointer Stores the address of the Pointer Variable

Declaration : Double Pointer

int  **ptr2ptr;

Consider the Following Example :

int num = 45 , *ptr , **ptr2ptr ;
ptr = #
ptr2ptr = &ptr;   

Now, When you print, then below will be the output.


num   = 45
&num   = 0xFF12FF      (Random address)

ptr   = 0xFF12FF      (Address of num)
*ptr   = 45                    (Value of num)
&ptr   = 0xAAAAAA    (Random Address)

ptr2ptr   = 0xAAAAAA     (Address of  ptr)
*ptr2ptr   = 0xFF12FF        (Value of ptr or address of num)
**ptr2ptr   = 45                      (Value of num)

Conceptually we can have Triple ….. n pointers

 Example : *****n,****b can be another example
answer Nov 11, 2016 by Chirag Gangdev
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...