Print ptr address c

To print pointer address using printf, we need to use %p format specifier.

Example

#include<stdio.h>

int main()
{
    int a = 10;
    int *ptr = &a;

    printf("Address of a = %p\n",ptr);

    return 0;
}

Output

Address of a = 0x7ffeee203bb8