Pages

Tuesday 5 March 2019

Program to illustrate single pointer and double pointer

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:

No comments:

Post a Comment

Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...