i made a property tax program but now i have to use it with pointers. i have to use 3 functions inputtotalsales,calculatetaxes,and displaytaxes.It was easy for me to do this the regular way but im having an issue with pointers . im getting errors saying redeclaration of statetax and countytax they were previously declared. What am i doing wrong why can i do it this way.
#include <stdio.h>
float inputtotalsales();
float calctaxes(float*,float* );
void displaytaxes(float,float);
int main()
{
float totalsale;
float statetax;
float countytax;
totalsale =inputtotalsales();
calctaxes(&statetax,&countytax);
displaytaxes(statetax,countytax);
return 0;
}
float inputtotalsales()
{
float totalsale;
printf("Enter total sales for month");
scanf("%2f",& totalsale);
return totalsale;
}
float calcstaxes(float *statetaxptr,float*countytaxptr)
{ float totalsale,statetax, countytax;//errors here
float statetax= totalsale*.04;
float countytax=totalsale *.02;
*statetaxptr=statetax;
*countytaxptr=countytax;
}
void displaytaxes(float statetax,float countytax)
{
printf("\n State tax is %.2f",statetax);
printf("\n County tax is %.2f",countytax);
printf("\n Total tax is %.2f",statetax+countytax);
}