Int main is a function . And it's a integer function , so it should return a integer . When we want to close our program , we should type "return 0 ;" (in int main()) . what if we type "return 34;" ? (returning a non-zero integer) . what will be happened ? I tried it , i didn't see any difference . Where this returned integer will be used ? If we return a non-zero integer , will it use more memory when program is closed ?
Asked
Active
Viewed 40 times
0
-
1It will be used in the environment that started your program, mostly as a success (zero) or fail (non-zero) indicator. – Some programmer dude Sep 22 '15 at 11:57
-
Agree. Concrete code can be used to switch action in external script (BAT file in DOS/Windows) `if errorlevel ...` Unix shell has similar (better) solution – Jacek Cz Sep 22 '15 at 12:12