r/programminghumor • • May 04 '25

A code doing nothing.

Post image
788 Upvotes

103 comments sorted by

View all comments

1

u/Poison916Kind May 06 '25

I use java so forgive me for my question. But why make the return type for the C/C++ language an int when it is printing and returning 0 when you can just make it a void type function?

1

u/zylosophe May 08 '25

the main() function must always return an int (which will be the process status code, 0 if no error, anything else it there is one). in fact you don't even have to use "return 0;" in main(), if the function reach the end before you return, it will default to return 0.