That's one way to do it...
You will need to do what real programmers do and look in your C Library Documentation for your compiler .... look for functions that help you classify characters as text, as digits, as whitespace etc... isdigit() is one.... what others can you find?