Categories
Mastering Development

How to get an integer from the user and loop if they enter anything else other than an Integer – C89

So I have a bit of code like this. Just a note this is in C89. void inputChoice(int* choicePtr) { int choice; printf(BLUE “\nINPUT: ” RESET); /* Print input using the ansi colour code for Blue. */ scanf(“%d”, &choice); /* Parse the choice. */ while ((choice < 1) && (choice > 5)) /* Loop until […]