Program to illustrate pointer variable using single pointer
#include <stdio.h>
int main()
{
int x=50,*y;
printf("\n x value is %d",x);
printf("\n x address is %p",&x);
y=&x;
printf("\n y value is %p",y);
printf("\n y address is %p",&y);
printf("\n y value is %d",*y);
return 0;
}
output:
Program to illustrate pointer variable using double pointer
#include <stdio.h>
void main()
{
int x=10,*y;
int **z;
printf("\n x value is %d",x);
printf("\n x address is %p",&x);
y=&x;
printf("\n y value is %p",y);
printf("\n y address is %p",&y);
z=&y;
printf("\n z value is %p",z);
printf("\n z address is %p",&z);
printf("\n y value is %d",*y);
printf("\n z value is %d",**z);
}
output:
#include <stdio.h>
int main()
{
int x=50,*y;
printf("\n x value is %d",x);
printf("\n x address is %p",&x);
y=&x;
printf("\n y value is %p",y);
printf("\n y address is %p",&y);
printf("\n y value is %d",*y);
return 0;
}
output:
#include <stdio.h>
void main()
{
int x=10,*y;
int **z;
printf("\n x value is %d",x);
printf("\n x address is %p",&x);
y=&x;
printf("\n y value is %p",y);
printf("\n y address is %p",&y);
z=&y;
printf("\n z value is %p",z);
printf("\n z address is %p",&z);
printf("\n y value is %d",*y);
printf("\n z value is %d",**z);
}
output:
No comments:
Post a Comment