I would suggest getting input as a string so that you can detect invalid characters. scanf() won't necessarily do that for you. For example you might type "123.45abcd" and scanf() will accept everything up to the first non-numeric character -- 'a' -- without any complaints. But if you want to produce a warning or error to the user then you should get the input as a string (such as call fgets() ) and validate each character.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Online 21,953 posts
since Aug 2005