C: invalid operands to binary expressions (не пойму, как делить, если нельзя делить указатель)
Не могу понять, как мне совершить деление. Выдает invalid operands to binary expressions. Проблема в строке 25, tax = tax_percent / 100 * bill_amount (и похоже, такая же ошибка тогда вылезет в tip = tip_percent / 100 * tax_bill). Порывшись в интернете, поняла только, что причина в том, что tax _percent это указатель. При попытке поставить (float)tax_percent выдает ошибку pointer cannot be cast to type float. Подскажите, пожалуйста, как мне тогда разделить?
// Data types, operations, type casting, return value
#include <cs50.h>
#include <stdio.h>
float half(float bill, float tax, int tip);
int main(void)
{
float bill_amount = get_float("Bill before tax and tip: ");
float tax_percent = get_float("Sale Tax Percent: ");
int tip_percent = get_int("Tip percent: ");
printf("You will owe $%.2f each!\n", half(bill_amount, tax_percent, tip_percent));
}
// TODO: Complete the function
float half(float bill, float tax, int tip)
{
float tax_percent();
float bill_amount();
float tip_percent();
//Convert tax percent into float. Bill times tax.
tax = tax_percent / 100 * bill_amount;
//Add tax to the bill
float tax_bill = tax + bill_amount;
//Convert tip percent into float. Bill times tip.
tip = tip_percent / 100 * tax_bill;
//Add tip to the bill and the tax
bill = tax_bill + tip;
//Divide it in two
return bill / 2;
}'''