Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误:在‘之前应为表达式;双倍’;。Can';使幂函数不起作用_C - Fatal编程技术网

错误:在‘之前应为表达式;双倍’;。Can';使幂函数不起作用

错误:在‘之前应为表达式;双倍’;。Can';使幂函数不起作用,c,C,我正在做一个基本的计划,我会给你我的贷款利率后 指定的年数。为此,我需要使用幂公式 totalLoanBalance = Double pow(interestRateAndPrincipal, yearsOutstanding) * LoansTaken; 但是当我输入这个信息时,我得到了这个错误 error: expected expression before ‘double’ totalLoanBalance = double pow(interestRateAndP

我正在做一个基本的计划,我会给你我的贷款利率后 指定的年数。为此,我需要使用幂公式

    totalLoanBalance = Double pow(interestRateAndPrincipal, yearsOutstanding) * LoansTaken;
但是当我输入这个信息时,我得到了这个错误

    error: expected expression before ‘double’
 totalLoanBalance = double pow(interestRateAndPrincipal, yearsOutstanding) * loansTaken;
                    ^

我尝试过在括号中的变量前面加上double,以及其他一些策略,但我似乎无法修复它。我也不明白错误告诉了我什么。谢谢您的帮助。

调用函数时,您不需要指定函数的返回类型,只有在定义或声明函数时才需要指定

totalLoanBalance = pow(interestRateAndPrincipal, yearsOutstanding) * LoansTaken;

这误解了C的函数调用语法。在调用函数时,您没有命名返回类型
totaloanbalance=pow(…
是正确的。当我取出double时,我在函数
main:loans.c:(.text+0xaf)中得到此错误消息:未定义对pow集合的引用2:错误:ld返回1退出status@DominicPelini那是因为你没有链接到数学库,而数学库就是
pow
所在的地方。在编译时将
-lm
添加到命令行。@DominicPelini很高兴我能帮上忙。如果你觉得有用,请随意。