示例代码:
#include
int main()
{
int x = 0;
If (x == 0) { // ‘If’应该是小写的‘if’
printf("x is equal to zero\n");
}
return 0;
}
〔小写所有关键字。
示例代码:
#include
int main()
{
int x = 0;
if x == 0 { // 缺少括号
printf("x is equal to zero\n");
}
return 0;
}
〔添加缺少的括号。
示例代码:
#include
int main()
{
int x = 65;
char c = x; // 整数类型不能赋值给字符类型
printf("c = %c", c);
return 0;
}
〔将变量c的类型更改为int。小写所有关键字。
示例代码:
#include
int main()
{
int x = 0;
if x == 0 { // 缺少括号
printf("x is equal to zero\n");
}
return 0;
}
〔添加缺少的括号。
示例代码:
#include
int main()
{
int x = 65;
char c = x; // 整数类型不能赋值给字符类型
printf("c = %c", c);
return 0;
}
〔将变量c的类型更改为int。
上一篇:编译器跟随集生成循环问题