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