+ 1

So if "int" means integer, why does the program start in int main ()? What does the int before the main signify?

int

26th Jan 2018, 3:00 PM
3ck
3ck - avatar
2 Answers
+ 3
The int is just the return type. Every function has a return type, and the return type of the main function is int. If you return 0 at the end of the main function, that means that your program closed without errors. If you return with any other integer that is interpreted as an error code. So if you return 1 in the main function, your program closes with error code 1. Users of your program can use the error code to figure out what's wrong.
26th Jan 2018, 3:02 PM
SplittyDev
SplittyDev - avatar
+ 1
Okay. Thanks.
26th Jan 2018, 3:05 PM
3ck
3ck - avatar