When writing a program in C / C ++, in particular, with the latest compilers, why do we need to return an integer from the main () method? Like int main (), we return "return 0" from it. So what is the reason for this?
It returns 0 to the OS to inform the OS that your program completed successfully.
The return value of main () becomes the process exit status. Traditionally, a zero exit status usually means “OK”, while any nonzero value indicates some error. This is similar to how many system calls also return zero or an error code.
. , : main() C ++?
, main() int main(). , , , script . 0 " ". , .
main()
int main()
0
int, main(), , "". main() . , , . , , .
. main 0, EXIT_SUCCESS?.
main() , . main() .C90/C99/++ 98:EXIT_SUCCESS, .
main() , . main() .
C90/C99/++ 98:
EXIT_SUCCESS, .
In other words, a specific meaning indicates success.
Source: https://habr.com/ru/post/1524810/More articles:gradle assembleRelease uses wrong key / certificate - androidSave time and currency for the user - timezoneGit help command does not open in a configured browser - gitFind downloaded file in iPhone document folder through iTunes - iosPySide вместо PyQt4 в качестве предпосылки для использования matplotlib Qt4Agg - pythonFile upload does not work with Rails 4 in development using Pow and Nginx - ruby-on-railsCustom reordering Kendo Grid - orderrails 500 error without writing a production log - ruby-on-railsBigcommmere Api creates a product with a link to an image - apiRails 3.2.13, 500 error in development without a log - ruby | fooobar.comAll Articles