fork download
  1. #include <stdio.h>
  2.  
  3. void local(void);
  4. void staticVar(void);
  5.  
  6. int main(void)
  7. {
  8. int i;
  9. for (i=0; i<3; i++)
  10. {
  11. local();
  12. staticVar();
  13. }
  14.  
  15. return 0;
  16. }
  17.  
  18. void local(void)
  19. {
  20. int count = 1;
  21. printf("local() 함수가 %d 번째 호출되었습니다.\n", count);
  22. count++;
  23. }
  24.  
  25. void staticVar(void)
  26. {
  27. static int static_count = 1;
  28. printf("staticVar() 함수가 %d 번째 호출되었습니다.\n", static_count);
  29. static_count++;
  30. }
Success #stdin #stdout 0s 5436KB
stdin
Standard input is empty
stdout
local() 함수가 1 번째 호출되었습니다.
staticVar() 함수가 1 번째 호출되었습니다.
local() 함수가 1 번째 호출되었습니다.
staticVar() 함수가 2 번째 호출되었습니다.
local() 함수가 1 번째 호출되었습니다.
staticVar() 함수가 3 번째 호출되었습니다.