error C2143: syntax error : missing ';' before 'type'

前端 未结 3 895
有刺的猬
有刺的猬 2020-12-01 17:55

I am new to programming C.. please tell me what is wrong with this program, and why I am getting this error: error C2143: syntax error : missing \';\' before \'type\

3条回答
  •  醉梦人生
    2020-12-01 18:47

    Visual Studio only supports C89. That means that all of your variables must be declared before anything else at the top of a function.

    EDIT: @KeithThompson prodded me to add a more technically accurate description (and really just correct where mine is not in one regard). All declarations (of variables or of anything else) must precede all statements within a block.

提交回复
热议问题