Just writing up some code, so far it all works perfectly until i accidentally enter a character (instead of an interger) for scanf.
It displays the menu over and over and over.....
Any ideas how i can get rid of this bug?
Im a beginner so i'd appreciate something as simplistic as possible.
The problem with "scanf" is that it leaves junk lying around in the buffer. If your menu is constantly being displayed, this might be the reason. Make a function like the one below, and call after the scanf line:
i tried checking the scanned value to see if its between 0 to 9, but if a character is press and it reloops.........its as if the programs skipping the scanf code and is just remembering what i had previously entered.
Im guessing the " ( " after (void) is mean't to be " { ".
also sorry for a million question but as i said im a beginner.
What would be the code to call this function, so i can put it after my scanf() statement?