我的代码有什么问题?
#include<stdio.h>
#include<string.h>
int main() {
FILE *file;
char string[32] = "Teste de solução";
file = fopen("C:\file.txt", "w");
printf("Digite um texto para gravar no arquivo: ");
for(int i = 0; i < 32; i++) {
putc(string[i], file);
}
fclose(file);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
错误:
c:\users\guilherme\documents\visual studio 2010\projects\helloworld\helloworld\hello.c(13): error C2143: syntax error : missing ';' before 'type'
1>c:\users\guilherme\documents\visual studio 2010\projects\helloworld\helloworld\hello.c(13): error C2143: syntax error : missing ';' before 'type'
1>c:\users\guilherme\documents\visual studio 2010\projects\helloworld\helloworld\hello.c(13): error C2143: syntax error : missing ')' before 'type'
1>c:\users\guilherme\documents\visual …Run Code Online (Sandbox Code Playgroud) c ×1