0

What is return = 0; at the end of code?

Return = 0

6th Sep 2021, 8:05 PM
Amin
Amin - avatar
3 Answers
+ 7
The main function is generally supposed to return a value and after it returns something it finishes execution.The return 0 means success and returning a non-zero number means failure. Thus we "return 0" at the end of main function. But you can run the main function without the return 0.It works the same . Source: Stackoverflow Happy coding!
6th Sep 2021, 8:08 PM
mesarthim
mesarthim - avatar
+ 2
mesarthim is right. Important: I suppose you mean „return 0;“ and not „return = 0;“. The equal sign normally is an assignment, but as „return“ is a reserved word it can possibly not be a variable‘s name (which it would be in case of being placed before an equal sign).
6th Sep 2021, 8:53 PM
KatharinaSt