All articles
c

A program to explain POINTERS to POINTERS

Share this article

Share on LinkedIn Share on X (formerly Twitter)

C Programming Language 111

  • Write a program to explain POINTERS to POINTERS

Program

#include <stdio.h>
 
void main()
{
    int a = 10, *p, **pp;
    p = &a;
    pp = &p; // (OR) // *pp = p;
 
    printf("&a = %u,\ta = %d\n", &a, a);
    printf("*p = %d\n", *p);
    printf("**pp = %d\n", **pp);
    printf("&p = %u,\t*pp = %u\n", &p, *pp);
 
    printf("\n");
}

Result

&a = 2226067540,        a = 10
*p = 10
**pp = 10
&p = 2226067544,        *pp = 2226067540

Comments