Pointer And Pointer To Pointer Program - C Program

Pointer And Pointer To Pointer Program

#include <stdio.h>
int main()
{
	int a=10;
	int *b;
	int **c; //pointer to pointer
	b=&a;
	c=&b;
	
	printf("Value of a=%d",a);
	printf("\nAddress of a=%u",&a);
	printf("\nAddress of a=%u",b);
	printf("\nValue of a=%d",*b);  // *b print value at address b
	*b=20;
	printf("\nNew Value of a=%d",a);
	printf("\nAddress of b=%u",&b);
	printf("\nAddress of b=%u",c);
	printf("\nValue of a=%d",**c);
	
}

Output

Value of a=10     
Address of a=2869083460
Address of a=2869083460 
Value of a=10 
New Value of a=20 
Address of b=2869083464 
Address of b=2869083464 
Value of a=20       
Compile and Run Online