#include <cs50.h>
#include <stdio.h>
int get_cents(void);
int calculate_quarters(int cents);
int main(void)
{
//Ask how many cents the customer is owed
int cents = get_cents;
// Calculate the number of quarters to give the customer
int quarters = calculate_quarters(cents);
cents = cents - quarters * 25;
}
int get_cents(void)
{
int cents;
do
{
cents = get_int("Changed owed: ");
}
while (cents < 0);
return cents;
}
int calculate_quarters(int cents)
{
return 0;
}
指向使用“int(void)”类型的表达式初始化“int”的整数转换的指针不兼容[-Werror,-Wint-conversion] int cents = get_cents;
1条答案
按热度按时间sczxawaw1#
这里你并不是真的调用函数get_cents,你必须使用如下的语法解释:
错误是因为
get_cents
是指向该函数的指针,而您将该指针赋给了int变量。