atoi and atof function will return the converted values.

your checking the return value is 0 or not. instead of you can check the given string is digit or not using isdigit() or isalpha()