小编Ste*_*ang的帖子

c 中函数调用中的参数太多?

我正在尝试创建一个颜色菜单,但最后一行报告了一些错误。

puts("I don't know about the color %c",input);
Run Code Online (Sandbox Code Playgroud)

这是声明

char input[7];
Run Code Online (Sandbox Code Playgroud)

和初始化

scanf("%c",&input);
Run Code Online (Sandbox Code Playgroud)

错误在这里

Too many arguments in function call
error: expected declaration specifiers or '...' before '&' token
scanf("%c",&input);
        ^
error: expected declaration specifiers or '...' before string constant
scanf("%c",&input);
   ^~~~
Run Code Online (Sandbox Code Playgroud)

为什么?

c printf scanf c-strings char

0
推荐指数
1
解决办法
433
查看次数

标签 统计

c ×1

c-strings ×1

char ×1

printf ×1

scanf ×1