What will be the output of the function if it gets called? int func(){ cout<<1; return 2; cout<<3; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What will be the output of the function if it gets called? int func(){ cout<<1; return 2; cout<<3; }

And how.. please tell

22nd Aug 2016, 11:09 AM
Soutik
Soutik - avatar
3 Answers
+ 4
1
22nd Aug 2016, 11:31 AM
GTimo
GTimo - avatar
+ 4
function prints 1 on screen, but returns 2. Function always stops running after returning any thing.
23rd Aug 2016, 6:01 AM
Olger Männik
Olger Männik - avatar
+ 3
1 because of return 2
22nd Aug 2016, 12:43 PM
Dev Singh
Dev Singh - avatar