0
Why we write "int" before writing main()
I see all places have something written before main(), like "void", "int"
3 ответов
+ 2
This is because main() is still a function, and like all C++ functions, requires a return type. Typically, that is int or void, but it's recommended to use int so you can end the program early if necessary.
+ 2
It's the result code for the parent process. Usually this is the operating system executor.
+ 1
1) "void main" is not (and never was) standard C. Use only "int main"
2) You can end the program early even if you use "void main" :)) . But... don't use it :)
3) The return code goes back to the parent process (the one that actually launched your program)