NO.143 定义&宏定义
Q:下列定义不正确的是A.#define P1 3.121592
B.#define S345
C.int max(x,y); intx,y;{ }
D.static char c;
答案是C,但不知道为什么
函数的具体实现应当
int max(x,y){
int x,y;
xxx
}
这种提问方法,会对其他人形成依赖,对自己的学习成长是不利的。 #include <stdio.h>
#include <math.h>
int main()
{
int max(x,y);
int x,y;
{
}
return 0;
}
7行 17列
'x' was not declared in this scope
7 19
'y' was not declared in this scope
7 20 int max(x,y);
expression list treated as compound expression in initializer [-fpermissive]
[错误]在初始化器中被视为复合表达式的表达式列表
把x,y先定义后
#include <stdio.h>
#include <math.h>
int main()
{
int x,y;
int max(x,y);
{
}
return 0;
}
7 20 int max(x,y);
expression list treated as compound expression in initializer [-fpermissive]
[错误]在初始化器中被视为复合表达式的表达式列表
风扫地 发表于 2022-3-7 23:01
函数的具体实现应当
int max(x,y){
int x,y;
#include <stdio.h>
#include <math.h>
int main()
{
int max(x,y)
{
int x,y;
xxx
}
return 0;
}
7行 17列
'x' was not declared in this scope
7 19
'y' was not declared in this scope
7 20 int max(x,y);
expression list treated as compound expression in initializer [-fpermissive]
8 3
expected ',' or ';' before '{' token
补;
#include <stdio.h>
#include <math.h>
int main()
{
int max(x,y);
{
int x,y;
}
return 0;
}
7行 17列
'x' was not declared in this scope
7 19
'y' was not declared in this scope
7 20 int max(x,y);
expression list treated as compound expression in initializer [-fpermissive]
所以int max(x,y); 是有什么问题?
页:
[1]