C program to print address of variable.

Posted by Mangesh on May 06, 2018

/* program to get the address of variable. */

Description :

In order to get the address of the variable we can use &<variable-name> and print it using %u.

Program :

#include<stdio.h>
void main()
{
 int number;
 int *ptr;
 printf("enter the number : ");
 scanf("%d",&number);
 ptr = &number;
 printf("\n%d is stored at %u.",number,ptr);
 getch();
}

Output :

c program for to get address of variable Executed and tested in Turbo C 3.2

Written with from Mangesh.

Related Post
1 C program to print address of variable.
2 C program to swap two number by refrence.
Latest Post
1 shubhanshu
2 test
3 C program for Breadth First Search.
4 C program for Depth First Search(DFS).
5 C for circular queue using linked list.