A program to print the direct and indirect address and its content using “address of operator” and “indirection operator
A program to print the direct and indirect address and its content using “address of operator” and “indirection operator”.
Codes
/*A program to print the direct and indirect address and its content*/
/*Programed by Jitendra Kr Yadav
10116
2 Apr,2011*/
#include<stdio.h>
#include<conio.h>
main()
{
int x;
int *pt;
printf(“Enter the number: “);
scanf(“%d”,&x);
pt=&x;
printf(“Value:\n”);
printf(“Direct value of x is %d.\n”,x);
printf(“Indirect value of x is %d.\n”,*pt);
printf(“Address:\n”);
printf(“Direct address of x is %d.\n”,&x);
printf(“Indirect address of x is %d.\n\n”,pt);
printf(“Press any key to continue…”);
getch();
}
Output
Enter the number: 5
Value:
Direct value of x is 5.
Indirect value of x is 5.
Address:
Direct address of x is 26867885.
Indirect address of x is 26867885.
Press any key to continue…
Comments (1)