F
Francine.Neary
I've been reflecting on these two types of pointer. As far as I can
glean from books, void * and char * are functionally equivalent: the
key property of both is that they are pointers that can be faithfully
cast to any other pointer type.
The only difference seems to be that it is legal to perform arithmetic
on a char *, but not on a void *.
So if a char * really is just a more functional void *, why would
anyone ever use a void * in their code, instead of a char *?
glean from books, void * and char * are functionally equivalent: the
key property of both is that they are pointers that can be faithfully
cast to any other pointer type.
The only difference seems to be that it is legal to perform arithmetic
on a char *, but not on a void *.
So if a char * really is just a more functional void *, why would
anyone ever use a void * in their code, instead of a char *?