C program to print the variable, the address of the pointer variable, and a pointer to pointer variable
Program:
#include <stdio.h>
void main()
{
int var;
int *ptr;
int **pptr;
var=3000;
ptr=&var;
pptr=&ptr;
printf("Value of var = %d\n",var);
printf("-----printing values using pointer-----\n");
printf("Value available at *ptr = %d\n",*ptr);
printf("Value available at **pptr = %d\n\n",**pptr);
printf("Address of var = %d\n",&var);
printf("-----printing addresses using pointer-----\n");
printf("Address of var = %d\n",ptr);
printf("Address of var = %d\n",*pptr);
}
Output:
Value of var = 3000
-----printing values using pointer-----
Value available at *ptr = 3000
Value available at **pptr = 3000
Address of var = -1209757212
-----printing addresses using pointer-----
Address of var = -1209757212
Address of var = -1209757212
Drafted on 🌏 by,
Comments
Post a Comment