what will be the output of the following 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 following function, if it gets called? int func(){ cout<<1; return 2; cout<<3; }

25th Aug 2016, 11:20 AM
Lekhraj Singh
Lekhraj Singh - avatar
2 Answers
+ 2
Just 1. cout << 3; will never execute because of that return 2; it is returning back to where it was called from.
25th Aug 2016, 12:01 PM
Cohen Creber
Cohen Creber - avatar
+ 1
thanks Cohen
25th Aug 2016, 12:34 PM
Lekhraj Singh
Lekhraj Singh - avatar