It's UWAweek 30 (2nd semester, week 1)

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying selected article
Showing 1 of 1168 articles.
Currently 8 other people reading this forum.


 UWA week 33 (2nd semester, week 4) ↓
SVG not supported

Login to reply

👍?
helpful
4:01am Wed 16th Aug, Christopher M.

Someone sent in this question by email:
> I observe that we always include exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) in the main function in our C programs. Is it a common practice as well as a requirement for our project assignments that we should always include these two exits in our main function?
The main() function may return (to the operating system) by calling the exit() function, simply calling return, or 'dropping off' the bottom curly bracket. In the last 2 cases, no call to exit() is required at all. We an assume that the anticipated exit status of a process is success - which we can indicate with exit(EXIT_SUCCESS) or even return EXIT_SUCCESS. A program that can never fail, presumably a very simple one or one that doesn't check enough things, will not even have a call to exit(EXIT_FAILURE). And there's a program, named false, that only ever exits with failure, never with success. So there's no general rule, nor requirement, about how any calls to exit() a program must have.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  7:24AM Jul 25 2024
Privacy policy