I am trying to figure out how to determine if the user input is a number and not a letter/symbol (A,a,!,@,#,$,%) in C, using a boolean function. The code I am using (if statement) only works for lower case and capitals letters. Below is my code for the if statement that works. Below that I will include the boolean function I am (unsuccessfully) attempting. Am I missing something in my boolean function?
if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')){
printf("Character '%c' does not represent a digit\n", ch);}
_Bool isNumber(char ch) {
printf("Character '%c' does not represent a digit\n", ch);
return 0;}
Is it possible without a library function?