When I compile the below program I get no errors or warnings; hever, when I run it, my output isn't as it should be. I know that the problem is passing the char taxcat because when I take it out, the output is fine. What am I doing wrong?
#include <stdio.h>
void readData (int*, char*, int*, int*);
main () {
int prodnum, quantity, price;
char taxcat;
printf("Please give PRODUCT NUMBER, TAX CATEGORY, QUANTITY and PRICE :\n"
readData (&prodnum, &taxcat, &quantity, &price);
printf ("Product Number: %d\nTax Category: %c\nQuantity: %d\nPrice: $%d\n\n", prodnum, taxcat, quantity, price);
printf ("Product Number: %d\nTax Category: %c\nQuantity: %d\nPrice: %d\n\n", &prodnum, &taxcat, &quantity, &price);
}
void readData (int *prodnum, char *taxcat, int *quantity, int *price){
scanf("%d%c%d%d", *&prodnum, *&taxcat, *&quantity, *&price);
}
#include <stdio.h>
void readData (int*, char*, int*, int*);
main () {
int prodnum, quantity, price;
char taxcat;
printf("Please give PRODUCT NUMBER, TAX CATEGORY, QUANTITY and PRICE :\n"
readData (&prodnum, &taxcat, &quantity, &price);
printf ("Product Number: %d\nTax Category: %c\nQuantity: %d\nPrice: $%d\n\n", prodnum, taxcat, quantity, price);
printf ("Product Number: %d\nTax Category: %c\nQuantity: %d\nPrice: %d\n\n", &prodnum, &taxcat, &quantity, &price);
}
void readData (int *prodnum, char *taxcat, int *quantity, int *price){
scanf("%d%c%d%d", *&prodnum, *&taxcat, *&quantity, *&price);
}