C programs

C Program for to print address of variable

In this program we see how to retrieve the memory address of an variable. And print the address of a variable on the screen, the symbol ‘&’ is used to store the address of variables.

Program

#include<stdio.h>

#include<conio.h>

void main()

{

int a=10,b;//variables declaration

clrscr();

b=&a;  //address of 'a' is store in b

printf("Address of a=%u",b);//display the address of 'a'

printf("\nValue of a=%d",a); //display the value of 'a'

getch();

}

When Run The Program Following Output:

Address of a=65524

Value of a =10

Description

 the symbol ‘&’ is used to store the address of variable in other variable.

Releted Programs

© 2017 codewmAll rights reserved.