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?
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.
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?