November 2002
Beginner to intermediate
142 pages
4h 19m
English
The
type
specifier void indicates that no value is
available. It is used in three kinds of situations:
There are two uses for void expressions. First,
functions that do not return a value are declared as
void. For example:
void exit (int status);
Second, the cast construction
(void)expression can be used to explicitly discard
the value of an expression. For example:
(void)printf("An example.");For example:
int rand(void);
The type void * (pronounced
“pointer to void”) represents the
address of an object, but not the object’s type.
Such “typeless” pointers are mainly
used in functions that can be called with pointers to different types
as parameters.
For example:
void *memcpy(void *dest, void *source, size_t count);
Read now
Unlock full access