0

what does the code '' return 0'' do in c++?

6th Mar 2017, 6:26 PM
miracle
miracle - avatar
4 odpowiedzi
+ 3
Common misconception : Not in C++, but in main(). In main(), where main() returns an int datatype, return 0 is an exit code used to tell your compiler to stop processing the main function. You can return some other value but werid results may sometimes occur.
6th Mar 2017, 6:55 PM
Wen Qin
Wen Qin - avatar
+ 1
You can write "void main(){}" instead
6th Mar 2017, 7:11 PM
Jacob Pham
Jacob Pham - avatar
0
The integer returned by main in C and C++ is considered the return status of the application. In most OSes 0 is considered a successful return and no problems happened.
6th Mar 2017, 6:38 PM
Alexandre Sabourin
Alexandre Sabourin - avatar