问题描述
我只是在学习C编程语言。您能向我解释为什么我的输出没有产生吗?
#include <stdio.h>
int main (void)
{
int x,total ;
printf("Enter the value of x : ");
scanf("%i\n",x);
total = (3 * x * x * x * x * x) + (2 * x * x * x * x) - (5 * x * x * x) - (2 * x * x) + (7 * x) - 6;
printf("Total value of the polynomial is %i\n",total);
return 0 ;
}
解决方法
将scanf更改为:
scanf("%i",&x);
您需要传递x的地址,以从scanf函数为其分配一个值。也没有\ n