fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int x = 0;
  5.  
  6. printf("x = %d [GS: グロバル変数xの初期値は0]\n", x);
  7.  
  8. printf("x = %d [GS: グローバル変数xに101を代入]\n", x);
  9.  
  10. printf("x = %d [GS: mondai1でグローバル変数xに102を代入]\n", x);
  11.  
  12. printf("x = %d [GS: mondai2を3回呼び、静的変数cの値10、11、12をxに代入]\n", x);
  13.  
  14. printf("x = %d [LA: for文内で自動変数のローカルxにi=103を代入]\n", x);
  15.  
  16. printf("x = %d [LA: mondai3がdを103から104に増やし、その値をローカルxに代入]\n", x);
  17.  
  18. printf("x = %d [GS: mondai3内でグローバル変数xを12から13に増加]\n", x);
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
x = 0 [GS: グロバル変数xの初期値は0]
x = 0 [GS: グローバル変数xに101を代入]
x = 0 [GS: mondai1でグローバル変数xに102を代入]
x = 0 [GS: mondai2を3回呼び、静的変数cの値10、11、12をxに代入]
x = 0 [LA: for文内で自動変数のローカルxにi=103を代入]
x = 0 [LA: mondai3がdを103から104に増やし、その値をローカルxに代入]
x = 0 [GS: mondai3内でグローバル変数xを12から13に増加]