fork download
  1. #include <stdio.h>
  2.  
  3. void foo(void)
  4. {
  5. int i = 0;
  6. i++;
  7. printf("%d\n",i);
  8. }
  9.  
  10. void static_foo(void)
  11. {
  12. static int i = 0;
  13. i++;
  14. printf("%d\n",i);
  15. }
  16. int main(void) {
  17. int i;
  18. for(i=0;i<5;i++)
  19. foo();
  20. printf("\n");
  21. for(i=0;i<5;i++)
  22. static_foo();
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
1
1
1
1
1

1
2
3
4
5