hello

my question would be if som1 can help out with a better prototype than i have for verifying if input is within ascii alphabetic range

what i have now

int betu (char s[]){
int i, jo=0;
for(i=0;i<strlen(s);++i)    {
if(!isalpha (s[i]) && s[i]!=' ' )
return 0;
else
++jo;
}
if(jo==strlen (s))
return 1; }

it gives 1 if sting is letter and space only , 0 if not

i like it because if my project says i musn't accept spaces , i can edit it very easily

however , when verifying a string with non ascii letters like "éíáúűáéóüö" my compiler (vs2010) will give me a kind error , i dont know about TC id be grateful if som1 checked it out tho . i dont need it to accept the non-ascii letters , english alphabet is ok , id be happy if som1 had an idea to make it stop giving an error

other than that it works fine and im very happy with it

Recommended Answers

All 4 Replies

Use isascii() function, to check if the character is ascii.

If you want to check for white space characters, you can use isspace() , which is in the same header file (ctype.h) that isalpha() is in.

If you want to check for white space characters, you can use isspace() , which is in the same header file (ctype.h) that isalpha() is in.

yes , i already have that covered , im looking for an array solution , or maybe i should make a new one ....

Since you seem to be getting answers that don't come close to a solution, maybe you need to describe again more clearly and in detail what you are trying to accomplish.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.