//WAP TO INITIALISE THE POINTER AND DISPLAY THE SAME.
#include<conio.h>
#include<stdio.h>
void main()
{
int a=10;
int *ptr;
ptr=&a;
clrscr();
printf("\n\nVALUE STORED AT A=%d",a);
printf("\n\nMEMORY ADDRESS OF A=%u",&a);
printf("\n\nVALUE STORED IN PTR=%u",ptr);
printf("\n\nVALUE WHICH IS POINTED BY PTR=%d",*ptr);
printf("\n\nMEMORY ADDRESS OF PTR=%u",&ptr);
getch();
}
/********************************************************************
OUTPUT
********************************************************************
VALUE STORED AT A=10
MEMORY ADDRESS OF A=65524
VALUE STORED IN PTR=65524
VALUE WHICH IS POINTED BY PTR=10
MEMORY ADDRESS OF PTR=65522
*/
No comments:
Post a Comment