| void | Keyword |
| Keyword Index |
Empty data type.
When used as a function return type, void means that the function does not return a value. For example,
void hello (char *name)
{
printf("Hello, %s.", name);
}
When found in a function heading, void means the function does not take any
parameters. For example,
int init (void)
{
return 1;
}
This is not the same as defining
int init ()
{
return 1;
}
because in the second case the compiler will not check whether the function is really called
with no arguments at all; instead, a function call with arbitrary number of arguments
will be accepted without any warnings (this is implemented only for the compatibility
with the old-style function definition syntax).
int x; float f; void *p = &x; // p points to x *(int*)p = 2; p = &r; // p points to r *(float*)p = 1.1;