uses of void
- as the (non-) return value of a function that doesn't return anything
-
so it is a syntax error to have
return myval;
one must have onlyreturn;
- as (non-) type of pointer to raw memory,
- as is returned from
malloc()
. One typically casts the pointer to a meaningful type:int *myIntArray = (int *)malloc( NUM_INTS * sizeof( int ) );
- one often sees conversion to
(void *)
from a non-void *
. -
This makes sense if thereafter the pointer is to be regarded
as a pointer to raw memory (as in
free()
ormemcpy()
). Otherwise it should be avoided.