#include<stdio.h>
int main()
{
float a;
int b;
char c;
float d;
scanf("%f %d %c %f",&a,&b,&c,&d);
printf("%c %d %f %f\n",c,b,a,d);
return 0;
}
提示a.c: In function ‘main’:
a.c:8:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%f %d %c %f",&a,&b,&c,&d);
如果你的代码本身没有问题的话,可以忽略这个警告。或者编译器设置里面抑制警告。
这么改,供参考:
#include<stdio.h>
int main()
{
float a;
int b;
char c;
float d;
if (scanf("%f %d %c %f",&a,&b,&c,&d) == 4)
printf("%c %d %f %f\n",c,b,a,d);
else
printf("Input error.\n");
return 0;
}
这个不用处理。你非要处理,他的意思这个函数是有返回值的。你找个变量接收一下他的返回值就行了。