変数を宣言せずにいきなり使うと出ます。C では JavaScript のように暗黙で変数が作られることはありません。
出るコード
int main(void) {
total = 10; // int total; を書いていない
return 0;
}
エラーメッセージ
error: 'total' undeclared (first use in this function)
note: each undeclared identifier is reported only once for each function it appears in
直し方
使う前に型を付けて宣言します(int total = 10;)。