0

Hey can anybody plzzz explain this problem of pointer,I’m lil confuse about that.

#include <stdio.h> int main() { char *p; p = "hello"; printf("%c",*&*p); return 0; }

25th May 2020, 2:58 AM
Siddhant Saxena
Siddhant Saxena - avatar
3 Respuestas
+ 1
For me the answer I got is h what about you?
25th May 2020, 5:07 AM
Isaac Duah [Active!]
Isaac Duah [Active!] - avatar
0
yepp, but i need explanation
25th May 2020, 5:09 AM
Siddhant Saxena
Siddhant Saxena - avatar
0
`*` dereferences a pointer. It turns a pointer into a value. `&` is the address operator. It turns a value into a pointer. `*` and `&` are inverses of each other, like `+` and `-`. So, `*&` cancels out, and `*&*p` is just `*p`. and `*p` dereferences the `char*` and turns it into `char`, and you see the first character.
25th May 2020, 6:25 AM
Schindlabua
Schindlabua - avatar