...
Wiki Markup |
---|
C99 Section 5.1.2.2.3 has this to say about returning from {{main()}} \[[ISO/IEC 9899-:1999|AA. C References#ISO/IEC 9899-1999]\]: |
...
Code Block | ||
---|---|---|
| ||
#include <stdlib.h> #include <stdio.h> int write_data(void) { char const *filenamefile name = "hello.txt"; FILE *f = fopen(filenamefile name, "w"); if (f == NULL) { /* handle error */ } fprintf(f, "Hello, World\n"); /* ... */ abort(); /* oops! data might not get written! */ /* ... */ return 0; } int main(void) { write_data(); return 0; } |
...
Code Block | ||
---|---|---|
| ||
#include <stdlib.h> #include <stdio.h> int write_data(void) { char const *filenamefile name = "hello.txt"; FILE *f = fopen(filenamefile name, "w"); if (f == NULL) { /* handle error */ } fprintf(f, "Hello, World\n"); /* ... */ exit(EXIT_FAILURE); /* writes data & closes f. */ /* ... */ return 0; } int main(void) { write_data(); return 0; } |
...
Wiki Markup |
---|
\[[ISO/IEC 9899-:1999|AA. C References#ISO/IEC 9899-1999]\] Section 5.1.2.2.3, "Program termination," and Section 7.20.4, "Communication with the environment" \[[ISO/IEC PDTR 24772|AA. C References#ISO/IEC PDTR 24772]\] "REU Termination strategy" |
...