Showing posts with label Reference and Dereference operator. Show all posts
Showing posts with label Reference and Dereference operator. Show all posts

Tuesday, April 7, 2015

Reference and Dereference operator

Algorithm
Step 1 : Start
Step 2 : Initialize x to 10
Step 3 : Print the value of x
Step 4 : Print the address of x using address operator
Step 5 : Print the value of x by dereferencing the address operator
Step 6 : Stop

Program (refderef.c)
/* Data and address */
#include <stdio.h>
main()
{
int x;
x=10;
printf("Value of x is %d",x);
printf("\nAddress of x is %u",&x);
printf("\nValue of x is %d\n",*(&x));
}