0
help siti the RETURN function
I still donāt understand what the purpose of the return funntion is... like wth does it even mena āreturn 0ā a the end of a code? idk
5 Answers
+ 4
The return statement is used to return some value or simply pass the control to the calling function.
The first form of the return statement is used to terminate the function and pass the control to the calling function. No value from the called function is returned when this form of theĀ returnĀ statement is used.
TheĀ returnĀ value has nothing to do with yourĀ OutputĀ value . That is even if your output isĀ 10Ā you returnĀ 0.
Every command returns an exit status (sometimes referred to as a return status or exit code). A successful command returns aĀ 0, while an unsuccessful one returns a non-zero value that usually can be interpreted as an error code. Well-behaved UNIX commands, programs, and utilitiesĀ returnĀ a 0 exit code upon successful completion, though there are some exceptions.
https://stackoverflow.com/questions/20919733/what-is-the-significance-of-return-0-in-c-and-c#:~:text=The%20main%20function%20is%20generally,0.It%20works%20the%20same%20.
+ 3
You don't need to understand it until you get more familiar with functions. (Chapter 4)