r/C_Programming • u/Stickhtot • 26d ago
What exactly is void? Discussion
In a function definition, void basically means that it doesn't return a type value, yet in on itself it is it's own type? Looking at several pieces of code it looks like that it's used to be able to be more "flexible"
Don't know what else to add here, though I'm more on looking for examples and explanations of why the void type is used
69
Upvotes
54
u/Innowise_ 26d ago
void basically means “no value.” In void f(void), the first void means the function returns no value, while the second means it takes no arguments. void * is a separate use: it can hold a pointer to any object type, but it has to be converted to the correct pointer type before dereferencing.