初級 › error: expected ';' before ... の原因と直し方 › パターン4
error: expected ';' before ... の原因と直し方
文末のセミコロンを書き忘れたときに出るエラーです。
1 #include <stdio.h> 2 3 int main(void) { 4 int width = 5; 5 int height = 3_ ^ 6 printf("%d\n", width * height); 7 return 0; 8 }
main.c:6:5: error: expected ',' or ';' before 'printf'
空欄を埋めてコンパイル・実行を通す
複数の変数を宣言する行でも規則は同じです。1つでもセミコロンを忘れると次の行でエラーになります。
次の問題