+ 1

Someone explane what is --x?

21st Feb 2017, 6:07 PM
Saba Tugushi
Saba Tugushi - avatar
6 Réponses
+ 4
b will equal -2
29th Jul 2017, 9:08 PM
Said BAHAOUARY
Said BAHAOUARY - avatar
+ 3
Decreases x by 1 and returns the new value.
21st Feb 2017, 6:15 PM
Tamás Barta
Tamás Barta - avatar
0
It's means the original value the at has been initialized - 1 e.g x = 2, - - x = x - 1
21st Feb 2017, 6:15 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
0
thanks
21st Feb 2017, 6:17 PM
Saba Tugushi
Saba Tugushi - avatar
0
Consider the following example code: int x = 0; int a = x--; int b = --x; "a" would equal 0 since the decrement occurs AFTER the assignment. "b" would equal -1 since the decrement occurs BEFORE the assignment.
21st Feb 2017, 7:51 PM
Tim Helland
Tim Helland - avatar