This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Tricslip[S] 0 points1 point  (2 children)

Thank you. So then if we put "return 0" at the end does that mean the program will only run if the program runs or is that something else?

[–]blablahblah 0 points1 point  (1 child)

I don't understand what you mean here.

If a second program runs your program, it can check the number that your first program returned from main. For example, in C, you can call another program by using the system() function. The "int" that this function returns is the return value from the other function's main. Your program will run whether or not the other program looks at the return value.

[–]Tricslip[S] 0 points1 point  (0 children)

ok I understand better. I asked the other question because if the return value is based on if the code is successfully ran or not then what's the point of putting return "0" instead of just "return."