Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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?