what format specifier should we use in printf in c to print the address of a float pointer

float* p;
if p points to float variable,say float x; and we want to print the address of x stored in p using p. then which format specifier should we use

%p format specifier can be used to print pointer address. See following illustration:

float x; // Variable x

printf("%p ", (void *)&x);   // Printing address of variable x

printfs ā€œ%pā€ format requires an argument of type void*, thus the type casting.

Hope it helps, Best Luck :slight_smile: