I am trying to let the user enter only a choice of 1,2or3
if the user enters a letter I want to give an error message.
So far my program crashes if the user enters a char.
I tryed to use atoi but it did not solve the problem....how can I solve it.....
Code:printf(" choice: "); scanf("%d", &choice); if (isalpha(choice)) choice=atoi(choice); fprintf(stderr,"incorrect choice, try again!\n");