The printf in the function should be:
printf("Func %d\n", *((int*)*p1));
In the function, p1
has the address of the integer pointer int * p
. This means dereferencing it once like *p1
is equivalent to the original pointer p
. Hence we cast it to an int *
and dereference it again to get the value.