+ 1

About 2D array

I used round bracket instead of parenthesis to check wheather it affects the code or not. It did and I'm unable to understand the difference. With parenthesis ,it give 1 as output while using round bracket ans is 3.Can someone explain why ? https://code.sololearn.com/cbdf27Vp8llV/?ref=app

5th Sep 2018, 5:38 PM
Maleeha Khalid
Maleeha Khalid  - avatar
3 Respuestas
+ 2
Iterator int a = (foo(), bar() + 13, 0); a == 0;
5th Sep 2018, 7:02 PM
Sergey Ushakov
Sergey Ushakov - avatar
+ 1
You made an expressions with operation ",". The result of the expressions is the last value in round brackets. You initialized only first row of the array.
5th Sep 2018, 6:11 PM
Sergey Ushakov
Sergey Ushakov - avatar
+ 1
Tind you right. Operators' priority is my weakness.
5th Sep 2018, 7:15 PM
Sergey Ushakov
Sergey Ushakov - avatar