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

4th Aug 2020, 10:38 PM
S M
S M - avatar
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.
5th Aug 2020, 6:37 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
You don't need to understand it until you get more familiar with functions. (Chapter 4)
4th Aug 2020, 10:51 PM
Seb TheS
Seb TheS - avatar