What does return actually mean? What does it give the user? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does return actually mean? What does it give the user?

12th Jun 2016, 7:23 AM
ethan
ethan - avatar
5 Answers
0
what the function return to the user. example: int sum () int x=5; int y=6; { int sum=x+y; return sum; } the function return the interger call sum. correct me if i wrote something wrong (sorry for my english)
12th Jun 2016, 9:07 AM
Marco Medri
0
@Marco Medri but if u write return 0 ,it will still work,why?
12th Jun 2016, 9:02 PM
Karanveer Singh
Karanveer Singh - avatar
0
@Karanveer Singh I think return 0 at the end is just states that the program ran successful. If it doesn't it will return a 1 instead
13th Jun 2016, 5:32 AM
ethan
ethan - avatar
0
@ethan no , 0 is the main function dude if u have 2 functions and u type return 1 you will return to f 2
13th Jun 2016, 11:42 PM
Enescu Catalin
Enescu Catalin - avatar
0
@Enescu Catalin well that's what I can digest
18th Jun 2016, 9:15 PM
Karanveer Singh
Karanveer Singh - avatar