I was just trying something to understand pointer to pointer deeply. I write the code below
int x = 20;
int *p0 = &x;
int *p1 = &p0;
printf("*p0 = %d\n", *p0);
printf("**p1 = %d\n", *((int *)*p1));
I thought the output would be
*p0 = 20
**p1 = 20
As *p1 would be evaluated to the address of x as an integer value and then I could use casting to de-reference the value in address x. since the value of *p1 represents a valid memory location of x. But the output was
I would like to understand this behavior.
NOTE - this is purely academic, I have no intention to write code this way