when scanf() succesfully reads an integer it returns a value of 1. what if its not an int. what if its a float value. will it still return a 1?
thanx..
when scanf() succesfully reads an integer it returns a value of 1. what if its not an int. what if its a float value. will it still return a 1?
thanx..
The world is waiting. I must leave you now.
>will it still return a 1?
Yes, it probably stops scanning once it sees a decimal point. If you need to know whether a float was entered, either:
read in the number as a string, check for a decimal point, then convert it using atoi
or
read in the number as a double, and use modf() to see if there is a fractional part.