+ 1
What is a void pointer? Can you dereference a void pointer without knowing its type?
2 odpowiedzi
+ 1
You cannot. Dereferencing a void pointer requires an explicit cast beforehand. You canofcourse cast it to any particular type and then dereference it without knowing itsoriginal type, but why you would want to do that is beyond me.
From
https://stackoverflow.com/questions/36931660/can-we-dereference-a-void-pointer-without-knowing-its-type
0
void pointer is also called generic pointer in C. It can hold an address of any type. You can't dereference it directly. You have to cast it for instance, *(int*)vptr