C++ Syntax Question

I’m curious about the usage of “return 0;” at the end of each function…I don’t quite understand why there’s a 0. I know this is inconsequential, but I would like to know why the application still runs if i interchange any number with the 0, but not without a number present. Any clarification would be appreciated.

You will go more indepth with return values and functions later in this section however the return statement in main() is used as an exit status for the application to tell the OS on how the program ended, for example if it exited successfully or not.

Privacy & Terms