+ 1

What makes --?

I don't understand what -- do I know that x=-1 =1 and x-=1 is 1 too but what do --? when you can German pls in German thanks for help

1st Aug 2017, 10:18 PM
Thore Himstest
Thore Himstest - avatar
11 Answers
+ 1
i cant't german, but... x=5 x-- output...x=4 x-- output...x=3
1st Aug 2017, 10:27 PM
Mane Antonio
Mane Antonio - avatar
+ 3
@Thore (re: Der erste Teil der Frage / regarding the first part of the question): x = -1 ---> im wirklichkeit, x ist: -1 (in actuality, x is -1) x -= 1 ---> x weniger oder "minus" einen / subtrahiert einen vom aktuellen Wert von x (x less or "minus" 1 / subtracts 1 from the current value of x) * Englisch ist meine Muttersprache (English is my mother tongue)
1st Aug 2017, 11:59 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
thanks this help me very much
1st Aug 2017, 10:29 PM
Thore Himstest
Thore Himstest - avatar
+ 2
Another example: for(int floor = 3; floor > 0; floor--) { cout << "Current floor is" << floor << endl; } cout << "Now on ground floor";
1st Aug 2017, 10:38 PM
James Cooke
+ 2
Danker. Nien know german Sorry ;)
1st Aug 2017, 10:40 PM
James Cooke
+ 2
and teach me german is unterrichte mich in Deutsch :)
1st Aug 2017, 10:47 PM
Thore Himstest
Thore Himstest - avatar
+ 1
;D
1st Aug 2017, 10:30 PM
Mane Antonio
Mane Antonio - avatar
+ 1
by the way...teach me german xD
1st Aug 2017, 10:39 PM
Mane Antonio
Mane Antonio - avatar
+ 1
:O
1st Aug 2017, 10:42 PM
Mane Antonio
Mane Antonio - avatar
+ 1
by the way is in german nebenbei
1st Aug 2017, 10:46 PM
Thore Himstest
Thore Himstest - avatar
+ 1
x++ or x-- is known as postfix ++x or --x is known as prefix Difference between postfix and prefix: int x = 5; // Postfix int y = x++; // First is the assignment (y = x), then the x variable is incremented by one (x = x + 1), so first y = x = 5, then x = 6 // Prefix int x = 5; y = ++x; // First x is incremented, then is the assignment, so x = 5 + 1, then y = x = 6
1st Aug 2017, 10:48 PM
Boris Batinkov
Boris Batinkov - avatar