在我的程序中,我必须询问用户该月的总销售额,然后询问用户县税率(6%)和州销售税(6%),然后计算总销售税他们输入了什么。我还必须使用指针。
我不断收到以下错误:[Error] 调用的对象“calculateTaxes”不是函数或函数指针
我似乎无法弄清楚。这是我到目前为止的代码
#include <stdio.h>
int inputTaxData(int* totalSales);
float calculateTaxes;
int main()
{
int* totalSales;
inputTaxData(&totalSales);
calculateTaxes();
float c;
float s;
float t;
return 0;
}
int inputTaxData(int* totalSales)
{
printf("What is your total sales for the month?");
scanf("%d", totalSales);
}
float calculateTaxes(float c, float s, float t)
{
float c = 1.06;
float s = 1.06;
float t = c + s;
printf ("Your total state and county sales tax is %f", totalSales);
}
最佳答案
您声明floatcalculateTaxes;
,即作为浮点变量。
然后你尝试将其作为函数调用。
calculateTaxes();
这就是编译器试图告诉你的。
您可能想为稍后定义的函数提供原型(prototype)。
float calculateTaxes(float c, float s, float t);
关于c - 错误调用的对象 'calculateTaxes'不是函数或函数指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58678321/