Need help explaining how it works. Prefix and postfix.

19th May 2019, 7:06 AM
Aboubakare Sidiki Kakoro
2 Answers
+ 1
Prefix: ++x/--x Postfix: x++/x-- If you use the prefix in an assignment, like y = ++x; then x will be increased by 1, and then it will be assigned to y Example: x = 5; y = ++x; //y AND x equals 6 Postfix: y = x++; x will be assigned to y, then increased by 1 Example: x = 5; y = x++; //y equals 5 and x equals 6 This was explained in every lesson about incrementing and decrementing, i don't understand why did you need to ask this question in the first place
19th May 2019, 7:26 AM
Airree - avatar
I just did not understand it fully, because it pretty much does the same thing. Just weirdly explained
19th May 2019, 2:49 PM
Aboubakare Sidiki Kakoro