I'm supposed to write a program that gets a list of IDs (5 digits each)from the keyboard. I have an issue with the input testing.
obviously an ID can't include anything but numbers (0-9).
I'm using "getchar()" which means every time it appears it gets the next character from the input list.
but in case of an illegal input (like a letter for example) I want to discard all the memory from the buffer and start the next "getchar()" with a new input. can I do that somehow?
0 · ·