0
How?
I had this question in a challenge on sololearn and the somehow the answer is that x = 1. How? The left side of the statement is false so it means that x=1 and then they add 1 to x so x = 2. Right? int x = !(1 > 0) ? 0:1; x = x++;
3 Antworten
+ 8
Here
The value of x is 1 and then the value is post incremented .
So x = 1
x = x++;
x will be one only
Note : inpost incremented method the value of the variable is initialised first followed by the increment of the value
+ 2
x is incremented to 2 later,
in x=x++ ,here x is 1
0
Thanks!