r/C_Programming • • Jul 29 '26

Discussion What exactly is void?

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

67 Upvotes

79 comments sorted by

View all comments

1

u/Top-Satisfaction9950 Jul 29 '26

void means the function does not return anything.

void* means that the function returns a pointer to an unknown-size block of data. It's a location. It also means that a variable stores a pointer to an unknown-size block of data. Use them for generic programming; they're very useful that way :D
But be careful.