C++ printing output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++ printing output

Hello, I couldn't understand the output of code below. Can anyone give some hint? https://code.sololearn.com/cIo4s3QK7P39/?ref=app

13th Feb 2019, 7:30 AM
okan
okan - avatar
2 Answers
+ 1
I do not understand it completely. What I do see. a=1,2,3,4,5; //because of the comma the compiler ignore ,2,3,4,5 a = 1 b=(1,2,3,4,5); b=5 // the () causes the compiler to take the last value to prove this have a look at c c=(1,2,3,4); c=4 I used "endl" to separate the different lines and understand that the result is not fifteen. https://code.sololearn.com/c3UEK8nLoRRr
13th Feb 2019, 9:48 AM
sneeze
sneeze - avatar
+ 1
Thank you, I didnt know about ignorence of comma and effect of paranthesis. Understood completely.
13th Feb 2019, 5:46 PM
okan
okan - avatar