It's UWAweek 9 (1st semester, week 1)


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 3 other people reading this forum.

 UWA week 34 (2nd semester, week 5) ↓
SVG not supported

Login to reply

7:40am Sun 20th Aug, Christopher M.

"Rory Cusworth" <23*7*5*4@s*u*e*t*u*a*e*u*a*> wrote:
> Is there a reason to use exit() over return to terminate a program, or are they equivalent in behaviour?
There is a (rare) case where you may need to consider their difference: - exit() terminates the current process, no matter where (from which function) it's called. If exit() is called from main() the whole process terminates. - return shifts execution to the function that called the current one. If main() was (seemingly) called from the operating-system then the return acts as if to terminate the current process. However, if main() was called by another function in the same process, perhaps a recursive call, then control returns to that calling function.

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  5:07AM Sep 06 2023
Privacy policy