return 0


if 0 is false and 1 is true what does return 0 means ?return a false value to compiler !? am i misundertanding something here??

Last edited on
The 0 and 1 are integer values.
The true and false are bool values.

A value of one type can in certain situations be converted into value of a different type.


Where is this return 0?
Last edited on
There are two different uses here.

If you cast an int to a bool, then 0 is false and everything else is true.

The return value of int main() is called the exit status and indicates whether the program completed successfully. An exit status of 0 indicates the program completed successfully. Any other number indicates an error of some sort. You can return different numbers to indicate different kinds of errors. See the link below for an example from the wget program:

https://www.gnu.org/software/wget/manual/wget.html#Exit-Status
Topic archived. No new replies allowed.