Back to Home & C
//Program to print a variable value and its address by using pointer
#include<stdio.h>
#include<conio.h>
void main()
{
int n,*pt;
clrscr();
printf("Enter a number\n");
scanf("%d",&n);
pt=&n;
printf("address of variable=%u\n",pt);
printf("Value of variable=%d",*pt);
getch();
}
----------------------------------------------------
Output
Enter a number
23
Address of variable=65524
Value of variable=23
===============================================
Back to Home & C
//Program to print a variable value and its address by using pointer
#include<stdio.h>
#include<conio.h>
void main()
{
int n,*pt;
clrscr();
printf("Enter a number\n");
scanf("%d",&n);
pt=&n;
printf("address of variable=%u\n",pt);
printf("Value of variable=%d",*pt);
getch();
}
----------------------------------------------------
Output
Enter a number
23
Address of variable=65524
Value of variable=23
===============================================
Back to Home & C
1 comment:
why u use * in value
and not use in address .....
Post a Comment