+ 2

What exactly does this line of code mean? int b= 1<--a

The full code: int a=5; int b=1<--a; How much is b after?

21st Oct 2019, 6:48 AM
Dasha Djordjevic
Dasha Djordjevic - avatar
3 Respuestas
+ 4
--a reduces a by 1 and returns the result. So it's the same as: b = 1<4; 1<4 is true, so b becomes 1. If it was false, b would become 0.
21st Oct 2019, 6:54 AM
HonFu
HonFu - avatar
+ 2
I mean the -- in the statement could be just a decrement operation and < could be comparison operator.
21st Oct 2019, 6:53 AM
Seb TheS
Seb TheS - avatar
+ 1
Isn't 1<--a almost same than 1 < (a - 1) ?
21st Oct 2019, 6:52 AM
Seb TheS
Seb TheS - avatar