why does this function crash my program
num is being passed by reference..Code:int checkPrice (int *num) { scanf ("%d", num); while (isalpha (*num)) { fflush (stdin); printf("Only numerals allowed\n"); printf("Please re-input the price: "); scanf ("%d", num); return 0; } fflush (stdin); return 1; }
basically, it works if i input a number but if i input a character it crashes and thats the exact thing i want to test in the program..
any other ways around it