fork download
  1. #include "stdio.h"
  2.  
  3. int main() {
  4. static int x = 5;
  5. static int *p = &x;
  6. printf("(int) p => %d\n",(int) p);
  7. printf("(int) p++ => %d\n",(int) p++);
  8. x = 5; p = &x;
  9. printf("(int) ++p => %d\n",(int) ++p);
  10. x = 5; p = &x;
  11. printf("++*p => %d\n",++*p);
  12. x = 5; p = &x;
  13. printf("++(*p) => %d\n",++(*p));
  14. x = 5; p = &x;
  15. printf("++*(p) => %d\n",++*(p));
  16. x = 5; p = &x;
  17. printf("*p++ => %d\n",*p++);
  18. x = 5; p = &x;
  19. printf("(*p)++ => %d\n",(*p)++);
  20. x = 5; p = &x;
  21. printf("*(p)++ => %d\n",*(p)++);
  22. x = 5; p = &x;
  23. printf("*++p => %d\n",*++p);
  24. x = 5; p = &x;
  25. printf("*(++p) => %d\n",*(++p));
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5408KB
stdin
Standard input is empty
stdout
(int) p   => 185393168
(int) p++ => 185393168
(int) ++p => 185393172
++*p      => 6
++(*p)    => 6
++*(p)    => 6
*p++      => 5
(*p)++    => 5
*(p)++    => 5
*++p      => 0
*(++p)    => 0