+ 1

What is difference between postfix and increment operator

4th Jul 2019, 1:05 PM
Naira Mishra
8 odpowiedzi
+ 2
Increment can be done in either prefix or postfix fashion.
4th Jul 2019, 1:59 PM
Sonic
Sonic - avatar
+ 1
But postfix is worked as increment operator in java.why
4th Jul 2019, 1:21 PM
Naira Mishra
+ 1
Thanks drax
4th Jul 2019, 1:41 PM
Naira Mishra
0
With example
4th Jul 2019, 1:05 PM
Naira Mishra
0
int i =0; cout << ++i; //display 1 cout << i++;//display 1 cout << i;// display 2
4th Jul 2019, 1:19 PM
Drax
Drax - avatar
0
Explains me please
4th Jul 2019, 1:19 PM
Naira Mishra
0
So basically, prefix increment force the evaluation of the increment before anything, whilst postfix is done after.
4th Jul 2019, 1:20 PM
Drax
Drax - avatar