I have the following piece of code. I want a user to enter a
or r
and continue executing the program, or try to get user input if he enters something else.
But my problem is, when I enter an illegal value the program shows the message twice, and not just once. How can I make the message only ever show once?
label:
puts ("a/r?");
c = getchar ();
if (c != 'a' || c != 'r')
goto label;