In C program, we use variables to store some value. Value of any variables are stored in a memory.
We can print memory address using following two methods:
- By using address of (&) operator
- By using pointer variable
"%p" is a format specifier to print a memory address in C language.
Let's see a program to print a memory address of a variable.
#include<stdio.h> int main(){ int number=5; float percen = 80.5; printf("Memory address of number variable: %p \n", &number); printf("Memory address of percen variable: %p", &percen); return 0; }