0

# INCREMENT AND DECREMENT

Need help explaining how it works. Prefix and postfix.

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

0

I just did not understand it fully, because it pretty much does the same thing. Just weirdly explained

Hot today

Задача 58.2

2 Votes

What i do wrong ?

0 Votes

Please rearrange int array:

0 Votes

Locked out by Rocket Icon

2 Votes

Помогите с кодом автобуса

0 Votes