Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,971 questions

51,913 answers

573 users

What is a pointer to pointer in C

1 Answer

0 votes
/*
Pointer to pointer (**pp) is a pointer variable which holds the address 
of another pointer variable (*p).
*/
 
#include <stdio.h>
 
int main(void)
{
    int n = 13, *p = &n, **pp = &p;
     
    printf("n    = %d (n)\n", n);
    printf("*p   = %d (*p = &n)\n", *p);
    printf("**pp = %d (**pp = &p)\n\n", **pp);
     
    printf("&n  = %p (n)\n", &n);
    printf("p   = %p (*p = &n)\n", p);
    printf("*pp = %p (**pp = &p)\n\n", *pp);
 
    printf("&p  = %p\n", &p);
    printf("pp  = %p (**pp = &p)\n\n", pp);
 
    printf("&pp = %p\n", &pp);
 
    return 0;
}
 


   
/*
run:
     
n    = 13 (n)
*p   = 13 (*p = &n)
**pp = 13 (**pp = &p)

&n  = 0x7ffcbff9f444 (n)
p   = 0x7ffcbff9f444 (*p = &n)
*pp = 0x7ffcbff9f444 (**pp = &p)

&p  = 0x7ffcbff9f448
pp  = 0x7ffcbff9f448 (**pp = &p)

&pp = 0x7ffcbff9f450
 
*/

 

 



answered Jun 20, 2017 by avibootz
edited May 21, 2024 by avibootz

Related questions

1 answer 132 views
132 views asked Jun 21, 2017 by avibootz
2 answers 195 views
1 answer 157 views
157 views asked May 5, 2017 by avibootz
2 answers 155 views
155 views asked May 5, 2017 by avibootz
1 answer 174 views
174 views asked Aug 23, 2016 by avibootz
1 answer 89 views
...