+ 1

What is the difference about --x and x-- ? I'm still confused about it, especialy when a question pop up like this --x++ 😂😂

10th Nov 2017, 7:50 AM
Ervin Winardo
Ervin Winardo - avatar
8 ответов
+ 18
a nice idiom to this topic, from oma falk (sometimes batman): what you see first, do first this one helps me, to manage ++x and x++
10th Nov 2017, 8:49 AM
tooselfish
tooselfish - avatar
+ 10
Use the search bar before asking. https://www.sololearn.com/Discuss/79231/please-explain-what-is-the-difference-between-x-and-xhttps://www.sololearn.com/Discuss/160327/what-is-the-difference-between-x-x-x-and-xhttps://www.sololearn.com/Discuss/55363/what-is-the-difference-between-x-and-xhttps://www.sololearn.com/Discuss/96907/whats-the-diference-between-x-and-xhttps://www.sololearn.com/Discuss/277955/what-is-the-difference-between-x-and-xhttps://www.sololearn.com/Discuss/70894/difference-between-x-xhttps://www.sololearn.com/Discuss/56740/what-is-the-difference-between-x-and-xhttps://www.sololearn.com/Discuss/336732/what-is-the-difference-between-x-and-xhttps://www.sololearn.com/Discuss/1556/what-is-difference-between-x-and-xhttps://www.sololearn.com/Discuss/425683/?ref=apphttps://www.sololearn.com/Discuss/812228/what-are-the-difference-between-x-and-x-and-how-to-understand/https://www.sololearn.com/Discuss/812228/what-are-the-difference-between-x-and-x-and-how-to-understand/https://www.sololearn.com/Discuss/19642/can-someone-explain-the-difference-between-x-and-x-for-me-in-a-dumb-way-thankshttps://www.sololearn.com/Discuss/224472/what-does-x-mean-and-also-what-does-y-meanhttps://www.sololearn.com/Discuss/166375/x-and-x-in-jshttps://www.sololearn.com/Discuss/177252/difference-between-a-and-ahttps://www.sololearn.com/Discuss/201489/what-is-difference-between-i-and-ihttps://www.sololearn.com/Discuss/619769/what-is-the-difference-between-i-and-i/https://www.sololearn.com/Discuss/98759/?ref=apphttps://www.sololearn.com/Discuss/126856/what-is-the-differences-between-prefix-x-and-postfix-x-in-chttps://www.sololearn.com/Discuss/775522/please-explain-the-prefix-and-postfix-in-the-incrementinghttps://www.sololearn.com/Discuss/63563/what-is-difference-between-prefix-and-postfix-increment-operatorhttps://www.sololearn.com/Discuss/452566/what-is-prefix-postfixhttps://www.sololearn.com/Discuss/123619/prefix-and-postfixhttps://www.sololearn.com/Discuss/38565/prefix-postfixhttps://www.sololearn.com/Discuss/305422/?ref=app
10th Nov 2017, 8:26 AM
qwerty
qwerty - avatar
+ 10
Remember lessons have many comments, you can find answers to many of your problems and much more interesting things! :)
10th Nov 2017, 8:54 AM
AZTECCO
AZTECCO - avatar
+ 6
@tooselfish is right x++ use the value of x and then incremnet by 1 ++x incremnet by 1 and then use the value of x i never really use x++ to be fair.
10th Nov 2017, 11:27 AM
D_Stark
D_Stark - avatar
+ 5
Okay, that's a very basic question. You should have cleared that out before started learning programming. But here's it... Example for Prefix Operators ... int x=2; // x is declared value 2 s = ++x; // ++x means the value of x is increased now and s will be equal to 3 now onwards Exampke for Postfix Operators... int x=2; // x equals 2 now s = x++; // postfix operator means that here in the line x will use it's original value but now onwards after this line, x's value will be increased to 3. so s=2, but now x=3.
10th Nov 2017, 8:35 AM
Aaron Stone
Aaron Stone - avatar
+ 4
If x=10 y=x++ y is 10 x is 11 y=--x y is 9 x is 9 y=++x-- y is 11 x is 10 Symbols before are seen by y. Symbols after only increase/decrease the x after y is assigned x's original value. So y=--x++ assigns the value of x-1 and x stays the same.
10th Nov 2017, 8:20 AM
Max S