Operations on pointers to void.
Stephen Clamage
steve at taumet.com
Sat Aug 11 01:37:16 AEST 1990
john at basho.uucp (John Lacey) writes:
>What operations are legal on pointers to void? ...
You may cast to or from type void*.
You may assign, initialize, or pass as a parameter any pointer to an object
of type void*, and vice versa.
You may not dereference an object of type void*.
>But, what about pointer arithmetic? And it that is legal, what size object
>does a void * point to?
You cannot do pointer arithmetic with an object of void*. No object may
have type void, so no size can be associated with it. It is helpful
to think of void as "not anything", rather than "zero". Void* is a
special case, and you can think of it as "pointing to something unspecified".
--
Steve Clamage, TauMetric Corp, steve at taumet.com
More information about the Comp.lang.c
mailing list