In the printf
call you’re casting the value of B
to char *
, but that’s not what you assigned to it. You assigned &A
which has type char **
.
You need to either assign A
to B
:
void *B = A;
printf("%p -- %p -- %s -- %s", (void *)&A, (void *)B, A, (char *) B);
Or cast B
to a char **
and dereference the casted pointer:
void *B = &A;
printf("%p -- %p -- %s -- %s", (void *)&A, (void *)B, A, *(char **)B);
0
solved C Pointer of another pointer