0

Can you explain. ...++a. Or --a ?

28th Jan 2017, 9:02 AM
Rajat Kumar
Rajat Kumar - avatar
2 ответов
+ 1
Hello ++ or -- are unary increment or decrement operators. Now, when you write say a++; it is Post increment and ++a; it is Pre increment now lets take a variable say i int i; if you write a = 5; i = a++; then the value of i will be 5. and value of a will be incremented after Semi Colon. but it you write a = 5; i = ++a; then the value of i will be 6, as a is incremented first and then value is assigned to the variable i.
28th Jan 2017, 9:23 AM
Arpan Lunawat
Arpan Lunawat - avatar
0
++a is upcreased nuber for one,--a is decreased nuber for one. for exapmle ++5 is 6 but --5 is 4...
28th Jan 2017, 9:23 AM
Dusan
Dusan - avatar