+ 2
what is i++ & ++i and if there's other like these please tell me it and their meaning
3 Réponses
+ 3
Understandable 👍
+ 2
these are called postfix and prefix.
I = your variable.
++ add to.
when it says I++ that means it runs the code and then adds 1 to that variable. that's postfix.
when it says ++I it adds 1 to the variable and then runs the code. that's prefix.
+ 2
For example, we have a variable X = 3 and call function value(X). In case postfix ( value(X++)) we pass value 3, whereas in our main function X will become 4. For prefix form ( value(++X) ) we pass 4.