C Program to Print Address of Pointers

In this program, you'll learn to print address of Pointers.



Source Code
#include<stdio.h>

int main()
{
    int a = 75, b = 81;
    int *p1, *p2;

    p1 = &a;
    p2 = &b;

    printf(" Value of a is %d", a);
    printf("\n Value of b is %d", b);
    printf("\n Address of a is %u", &a);
    printf("\n Address of b is %u", &b);
    printf("\n Value of p1 is %u", p1);
    printf("\n Value of p2 is %u", p2);
    printf("\n Address of p1 is %d", &p1);
    printf("\n Address of p2 is %d", &p2);
    return 0;
}
Output
 Value of a is 75
 Value of b is 81
 Address of a is 2358860
 Address of b is 2358856
 Value of p1 is 2358860
 Value of p2 is 2358856
 Address of p1 is 2358848
 Address of p2 is 2358840





"Coding Hub - Learn to code" app now available on Google Play Store