Code Fix

初級error: 'x' undeclared (first use in this function) の原因と直し方 › パターン3

error: 'x' undeclared (first use in this function) の原因と直し方

宣言していない変数を使ったときに出るエラーです。

 1  #include <stdio.h>
 2  
 3  int main(void) {
 4      for (_____ = 0; i < 3; i++) {
               ^
 5          printf("%d\n", i);
 6      }
 7      return 0;
 8  }
main.c:4:10: error: 'i' undeclared (first use in this function)

空欄を埋めてコンパイル・実行を通す

広告
広告スロット(未設定)

error: 'x' undeclared (first use in this function) の原因と直し方

宣言のタイプミスや、スコープの外で定義した変数を使おうとした場合に起きます。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)