+ 1
Prevent infinite loop in scanf function
Hi If we have a scanf(%d , &x) for integer but user input a char the program goes into a infinite loop How can I prevent that For example if user inputs a char the program ignore it or warn user to input integers Thanks
1 Antwort
0
Martin Taylor when scanf gets a char from input then repeats the scanf but do not get anything and saves the last character and again and again