You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please check the current issues Many bug reports are duplicates, this just creates more work for us. Searching the issues first may give you your answer or a workaround! If not adding new information to an existing report is much more helpful than a new report.
What Course are you in
Thinkcpp
What Page were you on
5.9 Returning from main
What is your username
None
Describe the bug
"The usual return value from main is 0, which indicates that the program succeeded at whatever it was supposed to do. If something goes wrong, it is common to return -1, or some other value that indicates what kind of error occurred."
Not correct!
The actual value returned to the O/S from main() is actually a 1 byte unsigned value, 0 - 255, even though main() returns an int. So returning -1 from main(), you are actually returning 255!
In stdlib.h, two macros are defined that are commonly used to return from main() or any other function:
"#define EXIT_SUCCESS 0"
"#define EXIT_FAILURE 1"
-1 is used for other purposes such as EOF, or "End Of File", or some other error condition.
Please check the current issues Many bug reports are duplicates, this just creates more work for us. Searching the issues first may give you your answer or a workaround! If not adding new information to an existing report is much more helpful than a new report.
What Course are you in
Thinkcpp
What Page were you on
5.9 Returning from main
What is your username
None
Describe the bug
"The usual return value from main is 0, which indicates that the program succeeded at whatever it was supposed to do. If something goes wrong, it is common to return -1, or some other value that indicates what kind of error occurred."
Not correct!
The actual value returned to the O/S from main() is actually a 1 byte unsigned value, 0 - 255, even though main() returns an int. So returning -1 from main(), you are actually returning 255!
In stdlib.h, two macros are defined that are commonly used to return from main() or any other function:
"#define EXIT_SUCCESS 0"
"#define EXIT_FAILURE 1"
-1 is used for other purposes such as EOF, or "End Of File", or some other error condition.
See: man EOF
Traceback
None
Javascript Errors
None
The text was updated successfully, but these errors were encountered: