Why the second output is 66?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why the second output is 66??

I just understand the first one. https://code.sololearn.com/cfRnbPoTCiE7/?ref=app

30th Dec 2019, 3:23 PM
Hyst1k
Hyst1k - avatar
4 Answers
+ 4
When there is no second parameter, the default parameter is used. In this case, the default value b takes is 42, so the output will be 24 + 42 = 66
30th Dec 2019, 3:27 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
Hyst1k no problem
30th Dec 2019, 3:50 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
because of (int b=42) b gets a default value if not provided. without that the code wouldn't work if only a single argument is given.
30th Dec 2019, 3:29 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
THANK YOU
30th Dec 2019, 3:46 PM
Hyst1k
Hyst1k - avatar