0
How to verify the scanf's input
Hello, i want some advice for the scanf function. The goal of the function is to ask to the "human part" what value does he want to enter, but what if the value does not correspond. For example: int b = 0; scanf("%d", &b); "repond of the human part" -> "hello" the variable "b" is an integer but the input is a string. How to verify if the input is garbage and then ask until the input is correct. I look forward to our answers, thank you
2 Antworten
+ 1
Thank you alot, i did not find any answer for that i didnt think about that.