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

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,095 questions

40,776 answers

573 users

How to use pointer to pointer in C

3 Answers

0 votes
#include <stdio.h>

int main(int argc, char **argv)
{
    int n = 7, *p = &n, **pp = &p;
	
	printf("%d\n", n);
	printf("%d\n", *p);
	printf("%d\n", **pp);
	
    return 0;
}


/*
run:

7
7
7

*/

 





answered Dec 24, 2018 by avibootz
edited Jun 30, 2019 by avibootz
0 votes
#include <stdio.h>

int main(int argc, char **argv)
{
    int n = 7, *p = &n, **pp = &p;
	
	printf("%d\n", n);
	printf("%d\n", *p);
	printf("%d\n", **pp);
	
	// address of n
	printf("%p\n", &n);
	printf("%p\n", p);
	printf("%p\n", *pp);
	
    return 0;
}


/*
run:

7
7
7
000000000062FE44
000000000062FE44
000000000062FE44

*/

 





answered Dec 24, 2018 by avibootz
edited Jun 30, 2019 by avibootz
0 votes
#include <stdio.h>

int main() {
    int n = 99;
    int *p;
    int **pp;

    p = &n;
    pp = &p;

    printf("n = %d\n", n);
    printf("*p = %d\n", *p);
    printf("**pp = %d\n", **pp);

    return 0;
}



/*
run:

n = 99
*p = 99
**pp = 99

*/

 





answered Jun 30, 2019 by avibootz

Related questions

2 answers 13 views
2 answers 34 views
2 answers 34 views
34 views asked May 12, 2023 by avibootz
1 answer 29 views
...