+ 5

What is the difference between ++i & i++

13th Nov 2016, 3:08 PM
B Shardiya
4 Answers
+ 7
well let's say x=i++ it is equal to writing x=i i=i+1 if x=++i it equals to writing i=i+1 x=i so if i=5 and x=++i then x=6 and i=6 and if x=i++ then x=5 and i=6
13th Nov 2016, 3:45 PM
Sunera Avinash
Sunera Avinash - avatar
+ 1
++i before increase , i++ after the increase
13th Nov 2016, 3:43 PM
Abdulrahman Khaled
Abdulrahman Khaled - avatar
0
The precedence
13th Nov 2016, 3:41 PM
Marcell Juhasz
0
Abdulrahman has it correct. The difference between i++ and ++i is when to calculate the addition. Do I run the command before adding one to the log or do I run the command after I add one?
14th Nov 2016, 5:30 PM
EWiles
EWiles - avatar