Why am I getting this warning while trying to compile my program?
%lf' expects argument of type 'double', but argument 2 has type 'double *'
I'm using CodeBlocks IDE, But these lines give a huge number:
double calculate1 = mealPrice * (double)(percentage)/100;
printf("The tip that you should leave is %lf \n", &calculate1);
I'm new to C programming and still learning stuff.
// CS 262, Lab Section <208>
// Lab 2
#include <stdio.h>
#include <stdlib.h>
int main(){
printf("Enter the price of the meal: \n");
double mealPrice = 0;
scanf("%lf\n", &mealPrice);
printf("Now enter the tip percentage: \n");
int percentage = 0;
scanf("%d\n", &percentage);
//Calculates tip amount in double, int, and float types
double calculate1 = mealPrice * (double)(percentage)/100;
printf("The tip that you should leave is %lf \n", &calculate1);
int calculate2 = (int)mealPrice * (int)(percentage/100);
printf("The tip that you should leave is %d\n", &calculate2);
float calculate3 = (float)mealPrice * (float)(percentage/100);
printf("The tip that you should leave is &f\n", &calculate3);
//Add tip to meal price
double total = calculate1 + mealPrice;
printf("The total price including tips is %lf\n", total);
printf("The meal cost is %f\nThe tip percentage is %d\nThe tip amount is%lf\nThe total cost is %lf\n", &mealPrice, &percentage, &calculate1, &total);
return 0;
}