C Program To Print Address of Memory Location Using Pointer

Write a C program to print the address of memory location using pointers. C Program :
/* Aim: Write a program to store address of memory location and print it */ 

#include<stdio.h>
void main()
{
	int x=10,*p; // Declaration of a pointer and a variable

	p=&x; //Assigning address of memory location of variable x 
	      //This is achived by using ampersand (&) operator

	printf("\n Address=%x \n \n",p); // Printing the address  

	printf("\n Value at address=%d \n \n",*p); //Printing the value of x

} // End of the main 



/* Output of above code:-

[root@localhost Pointers]# cc PtrIntro.c
[root@localhost Pointers]# ./a.out

 Address=cb96f4 
 

 Value at address=10 
 
*/  

Comments