Compile Error
/in/foo.c: In function 'main': /in/foo.c:9:5: error: expected expression before 'int' int tmp = a; ^~~ /in/foo.c:8:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (a > b) ^~ /in/foo.c:10:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' a = b; ^ /in/foo.c:11:9: error: 'tmp' undeclared (first use in this function); did you mean 'tmpnam'? b = tmp; ^~~ tmpnam /in/foo.c:11:9: note: each undeclared identifier is reported only once for each function it appears in
代码
#include<stdio.h>
int
main(void)
{
int a, b;
scanf("%d %d", &a, &b);
if (a > b)
int tmp = a;
a = b;
b = tmp;
printf("%d %d", a, b);
return 0;
}
信息
- 递交者
- 类型
- 递交
- 题目
- 用if语句实现选择结构
- 题目数据
- 下载
- 语言
- C
- 递交时间
- 2018-10-26 00:09:37
- 评测时间
- 2018-10-26 00:09:37
- 评测机
- 分数
- 0
- 总耗时
- 13ms
- 峰值内存
- 3.793 MiB