+ 2
Why void does not return any function
3 odpowiedzi
+ 3
That's the whole point of void, it doesn't return anything (unlike int or double).
+ 3
When C was invented the convention was that, if you didn't specify the return type, the compiler automatically inferred that you wanted to return an int (and the same holds for parameters).
But often you write functions that do stuff and don't need to return anything (think e.g. about a function that just prints something on the screen); for this reason, it was decided that, to specify that you don't want to return anything at all, you have to use the void keyword as "return type".
+ 1
the meaning of void itself says 'nothing'.
it was designed to use where you don't need to return anything