+ 5

What is () operator for three integer operands

int a,b,c,z; a=2; b=4; c=6; z = (a,b,c); cout << z; output of above code is 6. I am not getting why it is 6 and what does this code mean?

21st Mar 2018, 2:02 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Resposta
+ 22
well here comma operator also plays role... when more than 1 value is assigned to a variable using parentheses separated by comma operator... the rightmost value is assigned to the variable... so value of z here is c = 6 check out this link 👇 for more https://stackoverflow.com/questions/1428083/assignment-of-two-values-in-parentheses-in-c
21st Mar 2018, 2:20 PM
🌛DT🌜
🌛DT🌜 - avatar