code_junkie

What is the difference between ++i and i++

Nov 10th, 2011
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. i = 1;
  2. j = ++i;
  3. (i is 2, j is 2)
  4.  
  5. i = 1;
  6. j = i++;
  7. (i is 2, j is 1)
  8.  
  9. x = i++ + ++i;
  10.  
  11. x = ++i + i++;
  12.  
  13. int i=100;
  14. printf("%i;%i",i++,i);
  15.  
  16. for (int i = 0; i != X; ++i) ...
Add Comment
Please, Sign In to add comment