visual studio express complains missing ';' after type in c program

后端 未结 2 2049
北恋
北恋 2021-01-22 08:13

What is the problem with my code?

#include
#include

int main() {
    FILE *file;

    char string[32] = \"Teste de solução\";

           


        
2条回答
  •  天命终不由人
    2021-01-22 08:53

    Evidently you are compiling this as C, not C++. VS doesn't support C99, in which case you may not do this:

    for (int i = 0; i < 32; i++)
    

    You need to do this instead:

    int i;
    
    ...
    
    for(i = 0; i < 32; i++)
    

    Where the declaration of i must come before all statements in the function.

提交回复
热议问题