0

functions of return.

I just want to know the function of return in our code.Actually what does it mean?sometimes we write return 0 and sometimes else.why?

16th Nov 2018, 6:41 AM
ehsan ahmed
ehsan ahmed - avatar
2 ответов
+ 5
"In computer programming, a return statement causes execution to leave the current subroutine and resume at the point in the code immediately after where the subroutine was called, known as its return address. [...] ¹" And here ² are some important notes about the hidden curse of the UB and some other technical considerations. _____ ¹ https://en.wikipedia.org/wiki/Return_statement ² https://en.cppreference.com/w/cpp/language/return
16th Nov 2018, 7:00 AM
Babak
Babak - avatar
+ 2
In your main() function, return 0; indices that your program has successfully compiled and finished. You usually use 0 for success and any other value if something is wrong. This comes in handy if some other application needs to know the return status of your program. Also, please remember to use the search bar before posting a question. The following threads might furthermore be able to help you: https://www.sololearn.com/discuss/738286/?ref=app https://www.sololearn.com/discuss/81364/?ref=app https://www.sololearn.com/discuss/220394/?ref=app https://www.sololearn.com/discuss/1492351/?ref=app https://www.sololearn.com/discuss/673232/?ref=app
16th Nov 2018, 7:00 AM
Shadow
Shadow - avatar