Here is my code:
#include <stdio.h>
int main (void)
{
double itemCost;
double paidMoney;
int changeDue;
printf("How much does the item cost: ");
scanf("%lf", itemCost);
printf("How much did the coustomer pay: ");
scanf("%lf", paidMoney);
changeDue = ( (itemCost - paidMoney) * 100);
printf("Change due in pennies is: %i", changeDue);
}
The program will have a simple inputs like 9.5 which represents £9.50 therefore I am using double to store my values. Also printf and scanf promotes floats to doubles so it does not really matter.
However, when compiling with gcc, I get an error message saying:
cashReturn.c:10:15: warning: format specifies type 'double *' but the argument has type 'double' [-Wformat]
What does this error mean and why is it popping up?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…