`void` — C Keyword
`void` — C Keyword
The void keyword in C: represents the absence of type.
`void` — C Keyword
The void keyword in C: represents the absence of type.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
void (C)Represents the absence of type. Used as a function return type when no value is returned, and as void* for an untyped pointer.
void function-name(params);
void* ptr;
#include <stdio.h>
#include <stdlib.h>
void greet(const char* name) {
printf("Hello, %s!\n", name);
}
int main(void) {
greet("World");
/* void* — generic pointer */
void* raw = malloc(4 * sizeof(int));
int* arr = (int*)raw;
arr[0] = 42;
printf("%d\n", arr[0]); /* 42 */
free(raw);
return 0;
}
void* can hold any object pointer; it must be cast before dereferencing.f(void) in a parameter list (K&R vs. ANSI) means the function takes no parameters in C. In C++, f() means the same thing.voidint main() {
// Pick one facility from this reference page.
// Write the smallest program that exercises its main precondition,
// complexity rule, or lifetime constraint before scaling up.
return 0;
}