Good Evening. I'm new to C. Can you please help me.
I'm creating an error checking function, user will input a string, this will check if the input is all alphabet or all letters only. If there is a digit or other special char, it will print Error then ask input from user again.
Here's my code. I don't know what's wrong
int isValid (const char str[], const int max) {
int i;
for (i=0; i<= max; i++) {
if (isdigit(str[i])) {
printf("Letters and spaces are only allowed\n");
return 1;
\}
else \{
return 0;
}
}
}
I'm from the Philippines. Thank you very much.
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).