Can anyone explain me what is the use of return ??? What is the difference between return 0 return 1 return 4*factor(n-1) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone explain me what is the use of return ??? What is the difference between return 0 return 1 return 4*factor(n-1)

what is this all ??? is there any use of using return instead of return to main main ?????

23rd Oct 2016, 1:39 PM
Pradeep C
Pradeep C - avatar
2 Answers
+ 1
Functions work kinda like in math: You put something in, the function does it's magic and you get a result. Consider the simple linear function y=mx+n. For every x you put into this function you will get a y out of it. That's the same with C++: double y(double x) {return 2*x+1;}
23rd Oct 2016, 1:52 PM
Ullrich Franke
Ullrich Franke - avatar
- 2
return 0 means false 1 means true
30th Oct 2016, 10:27 AM
GOKUL KRISHNA YADAVA P
GOKUL KRISHNA YADAVA P - avatar