fork download
  1. #include <stdio.h>
  2.  
  3. int x;
  4. void mondai1(int b){
  5. x = b;
  6. }
  7. void mondai2(void){
  8. static int c=10;
  9. x = c;
  10. c++;
  11. }
  12. int mondai3(int d){
  13. x++;
  14. d++;
  15. return d;
  16. }
  17. int main(void) {
  18. printf("x = %d[G:3行目のxの値代入]\n",x);//3行目のx0
  19. x = 101;
  20. printf("x = %d[G:前行で値101を代入]\n",x);//19行目のx101
  21. mondai1(102);
  22. printf("x = %d[G:前行でmondai1を呼び出して戻り値を代入、戻り値は引数のまま]\n",x);//5行目のx102
  23. mondai2();
  24. mondai2();
  25. mondai2();
  26. printf("x = %d[G:3回呼び出して戻り値代入]\n",x);//9行目のx12
  27. for (int i =103; i<104;i++){
  28. int x = i;
  29. printf("x = %d[L:前行のx=i代入]\n",x);//28行目のx103
  30. x = mondai3(i);
  31. printf("x = %d[L:前行でmondai3を呼び出して戻り値を代入、戻り値は引数に+1]\n",x);//30行目のx104
  32. }
  33. printf("x = %d[G:13行目でxの値を++]\n",x);//9行目のx13
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
x = 0[G:3行目のxの値代入]
x = 101[G:前行で値101を代入]
x = 102[G:前行でmondai1を呼び出して戻り値を代入、戻り値は引数のまま]
x = 12[G:3回呼び出して戻り値代入]
x = 103[L:前行のx=i代入]
x = 104[L:前行でmondai3を呼び出して戻り値を代入、戻り値は引数に+1]
x = 13[G:13行目でxの値を++]