Did a search, nothing really came up so here goes..
I have a long floating input in my program where the user needs to input a value with a decimal point.
Code:
printf("Please enter the altimeter setting (xx.xx): ");
scanf("%lf", &s);
And they input 29.92 or whatever..
Problem is let's say they input 29,92, or the letter "a", or anything else besides a number and a decimal. That basically sends the program into an uncontrollable loop of sorts and crashes.
How do I handle incorrect inputs like that? I have a simple while loop to keep unwanted numbers from being entered but I'm not sure about characters and symbols and such..