+ 1
++a,a++,--a,a-- means
int a=6; b=++a console.writeline(b) ans plzz and why
3 ответов
+ 2
a++ get (a) value before increment a. ++a get (a+1) before increment a. In both, the result of a=a+1. Example a = 6; Print(a++) output 6, and Print(++a) output 7. After a = 7
+ 1
++a means pre increment, here the value of a is increment by 1.
a++ means post increment, here the value of a=a+1.
same thing happen with --a,a--
0
b = a++
//6 will become value before incrementation
b = ++a
//7 becomes value after incrementation
Same goes for a-- and --a
b = a--
//6
b = --a
//5