0
Please help me in learning prefix and postfix with an example
2 odpowiedzi
0
If you have
A= 2
B=3
And say
Y= a+b++;
That means you will add a to b and then increment the b. it will look like this
Y= 2+3;
Changes B to 4
If you have
Y= a+(++b) you're telling the compiler to add A to B After you increment the B
So it will look like
Y=2+4
B=4
Same thing goes for decrementing.
0
the difference is it adds 1 and then assigns it to the variable, the other does this in reverse