Function of return cpp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Function of return cpp

i don't really understood what a function of return in cpp there's more different return return (resume); return 0; return -1; is all return have many different and function? , pls tell me

18th Oct 2017, 5:02 AM
Alfajri Asnan Kusuma
Alfajri Asnan Kusuma - avatar
2 Answers
+ 2
Return in CPP actually means the end result of a particular function so as to be used in other part of the program. functions takes in parameters to return a result. Lets take for example a blender. A blender has a function in the kitchen. When you put tomatoes "parameter" switch on d blender and when you turn it off, you will get grinded tomatoes "return". if you put in apples, bananas, oranges, strawberries and mangoes "parameters" into a blender. when switched on for some minutes and switched off, you will get in return a smoothie juice. int blender (apples, mangoes, bananas) { int smoothie; int apples = 3, mangoes = 5, bananas = 2; smoothie = apples + mangoes + banana; return smoothie; } NB: Explained just for real world understanding ..
18th Oct 2017, 5:40 AM
Franky BrainBox
Franky BrainBox - avatar
+ 1
ok, so return as the result of particular function thank you
18th Oct 2017, 6:36 AM
Alfajri Asnan Kusuma
Alfajri Asnan Kusuma - avatar