What does the return 0; function mean | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does the return 0; function mean

22nd Sep 2017, 5:50 PM
FREEZE
FREEZE - avatar
6 Answers
23rd Sep 2017, 1:02 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
What Suriya said. The 0 or 1 is its exit status that the OS uses to potentially display an error or not, depending upon if there was an error or if it closed successfully.
22nd Sep 2017, 5:58 PM
AgentSmith
+ 3
In a method/Function it is possible to send a value to where it has come from: int getNumber(){ return 0; } so if I call this like so: print( getNumber() ); it will print out the value 0 because the Function is RETURNING 0
22nd Sep 2017, 5:57 PM
Limitless
Limitless - avatar
+ 3
@Dwayne The same thing it means in English.... it brings something back. It returns a value to whatever called the function.
22nd Sep 2017, 6:07 PM
AgentSmith
0
In C and C++ programs the mainfunction is of type int and therefore it should return an integer value. ... On most operating systems returning 0 is a success status like saying "The program worked fine". In C++ it is optional to type " return 0; " at the end of the main function and the compiler includes it automatically.
22nd Sep 2017, 5:56 PM
Suriya
Suriya - avatar
0
what exactly does the term "return " mean in c++
22nd Sep 2017, 6:05 PM
FREEZE
FREEZE - avatar