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