gpt4 book ai didi

c - 错误调用的对象 'calculateTaxes'不是函数或函数指针

转载 作者:行者123 更新时间:2023-11-30 19:25:30 26 4
gpt4 key购买 nike

在我的程序中,我必须询问用户该月的总销售额,然后询问用户县税率(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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com