KaiquanMah's picture
Create 13B. Expression Statements Values+++
d58d581 verified
raw
history blame
538 Bytes
row1
int a = 3;
int b = a++ + 1;
a = 4; // a++
b = 4; // initial 'a' 3 + 1
row2
int a = 3;
int b = ++a + 1;
a = 4; // ++a
b = 5; // updated 'a' 4 + 1
row3
int a = 1;
int b = ++a + ++a;
a = 3; // ++a then ++a again
b = 5; // LHS ++a 2 + RHS ++a 3
row 4
int a = 3;
int b = a++ + a--;
a = 3; // a++ then a--
b = 7; // initial 'a' 3 + LHS 'a' 4
row5
int a = 3;
int b = --a; // --a => so 'a' decrease from 3 to 2, AND b = updated 'a' = 2
a = --b; // --b => so 'b' decrease from 2 to 1, AND a = updated 'b' = 1
a = 1;
b = 1;