Hey C programming forums
its me again :P
Still doing basics of C
I get alot of whats being told in the book, and its helping me think for myself and after about a good 20 mins of searching I have no idea how to fix this error.
As an exercise I have to build a program that scans values of wages, hours worked, and tax rate which than becomes a final value in the variable final_payment.
Unfortunately I keep getting segmentation errors when everyone enters their hour wages (first variable).
Now I get 2 warning messages when compiled so maybe that is the reason why and I can honestly tell you I don't completely get exactly about conversion specifiers and how different types integrate with each other so I am hoping you guys/girls can clear things up.
Code:
#include <stdio.h>
int main(void)
{
float u_wage;
int tax_rate;
int u_hours;
float final_payment;
printf("Enter the amount of pay you get per hour: ");
scanf("%f", u_wage);
printf("Enter the amount of hours you worked: ");
scanf("%d", u_hours);
printf("Enter your current tax rate to be deducted from your pay: \n");
final_payment = (u_wage * u_hours) - (tax_rate/100);
printf("Your final payment is %f", final_payment);
return 0;
}
Warnings:
Code:
|warning: format ‘%f’ expects type ‘float *’, but argument 2 has type ‘double’|
warning: format ‘%d’ expects type ‘int *’, but argument 2 has type ‘int’|
||=== Build finished: 0 errors, 2 warnings ===|