solve with increment and decrement . a=7 , b=5 , c=2. Q= ++a,--a,b++,c++ please explain
Answers
Answered by
1
Q = ++a
Assigns 8 .. This is because postfix first increments the value and then assigns it to the variable.
Q = --a
Assigns 7 .. because its previous value was 8 .. see first answer. It first decreses the value of the variable and then assigns it to the variable.
Q = b++
Assigns 5. because prefix first assigns the value and then increases it.
Q = c++
Assigns 2 . because prefix first assigns the value to the variable and then increases it.
Similar questions