What is the use of %p in C

What is %p in C Programming ?

%p is a format specifier in C Programming language, that is used to work with pointers while writing a code in C.
Access specifier-%p in c

How to use %p in C Programming?

Lets see an example and understand the working of %p format specifier in C programming language –

Example –

// %p prints the address in hexadecimal format
int main() 
    int var = 10;
    // declaring pointer variable to store address of var
    int *ptr = &var; 

    printf("The address in decimal : %d \n", ptr); 
    printf("The address in hexadecimal : %p \n", ptr); 

    return 0; 


The address in decimal : 1044715932 
The address in hexadecimal : 0x7fff3e45199c