Originally Posted by
transgalactic2
so **p point to a Node * type variable
Of course not.
p points to a Node*!
Pointers to pointers are not special!
So dereference your pointer and you get the original Node* variable.
But wait, you can dereference that original variable too, so you get the Node value (or data).
Code:
int* x = malloc( sizeof(int) );
*x = 100;
int** y = &x;
printf("%i", **y);
printf("%i", *x);
// y = address of x (pointer to x!)
// *y = x (the address in x!)
// **y == 100 (the value pointed to by x!)
free(*y);
*y = malloc( sizeof(int) );
**y = 200;
printf("%i", **y);
printf("%i", *x);
free(x);
How does this code work and what does it print, do you think?