hey
I'm new to c and programming in general and there's something I can't figure out. I was hoping you could help me.
I'm writing a program (home work) that supposed to receive a list of 5 digit IDs from the keyboard (for unlimited and unknown number of IDs) and then print an error for any ID which has a character in it (like a letter or anything else that is not a number).
I've been trying to do it with scanf (%d) and a while loop with an EOF. and it's simply not working.
I basically have a problem with illegal input. I don't understand how scanf behaves if it supposed to receive and integer and it gets something like 12a34.
I need it to print an error and then go on with the next ID.
any help?



1Likes
LinkBack URL
About LinkBacks



