fork download
  1. #include <stdio.h>
  2.  
  3. int x;
  4.  
  5. void mondai1(int b){
  6. x = b;
  7. }
  8.  
  9. void mondai2(void){
  10. static int c = 10;
  11. x = c;
  12. c++;
  13. }
  14.  
  15. int mondai3(int d){
  16. x++;
  17. d++;
  18. return d;
  19. }
  20.  
  21. int main(void){
  22. printf("x=%d(GA(グローバル変数でxが初期値)\n", x);
  23. x = 101;
  24. printf("x=%d\n", x);
  25. mondai1(102);
  26. printf("x=%d\n", x);
  27.  
  28. mondai2();
  29. mondai2();
  30. mondai2();
  31. printf("x=%d\n", x);
  32.  
  33. for(int i = 103; i < 104; i++){
  34. int x = i;
  35. printf("x=%d\n", x);
  36. x = mondai3(i);
  37. printf("x=%d\n", x);
  38. }
  39.  
  40. printf("x=%d\n", x);
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
x=0(GA(グローバル変数でxが初期値)
x=101
x=102
x=12
x=103
x=104
x=13