0

why we use "return" for ??? and please define it as you understand

22nd Sep 2016, 4:30 PM
Kaung Myat Thu
Kaung Myat Thu - avatar
3 odpowiedzi
0
Without return , the loop will carry on working wasting all the resources......Take care never remove the last return Zreo of the int main() given with that C++ standard coding used in that class... why not publicizing your codes for me to see ????????
25th Nov 2016, 9:56 AM
Az.
Az. - avatar
+ 1
return is used with functions in c++. Most of the functions are designed to input a value process it and then output the processed result. The return statement gives(or more appropriately returns) the output value of a function. for example consider a function: int myFunction(int a) { return a*2; } int main() { cout << myFunction(6) return 0; } Outputs 12 now myFunction() whenever used in a program will return the doubled value of it's parameter as seen above.
22nd Sep 2016, 5:05 PM
Mohammed Maaz
Mohammed Maaz - avatar
+ 1
return is used to tell the program or class the final result, for the main function this is mostly to tell the program it's finished all its function
22nd Sep 2016, 11:14 PM
Justin Vitale
Justin Vitale - avatar