I think the output of the code is 19. But There is no 19 in the possible answers. Is there any trick? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

I think the output of the code is 19. But There is no 19 in the possible answers. Is there any trick?

int Sum(int a=3, int b =8) {return a+b;} int main(){ int b=11; cout<< Sum(b); }

5th May 2020, 3:48 PM
Win Htay 🇲🇲
Win Htay 🇲🇲 - avatar
5 Answers
+ 1
There is no trick the answer is 19.
5th May 2020, 4:18 PM
Mustafa K.
Mustafa K. - avatar
+ 1
Abhay no, variable names have nothin to do with that.
5th May 2020, 4:21 PM
Mustafa K.
Mustafa K. - avatar
+ 1
Mustafa K. thks for correcting me
5th May 2020, 4:23 PM
Abhay
Abhay - avatar
0
Yes Sir! I see!
5th May 2020, 4:19 PM
Win Htay 🇲🇲
Win Htay 🇲🇲 - avatar
0
Yes , the output of this code is 19, because Sum has 2arguments , when you gave 1st argument b=11, you dont write second argument , so second argument of Sum function became b=8 , because you get return 11+8; -->11+8=19<---
5th May 2020, 5:18 PM
꧁༒☬Bad☬Boy☬༒꧂
꧁༒☬Bad☬Boy☬༒꧂ - avatar