I have a a homework, and my professor said some of the students figured out that they could check whether the characters they read in are specific ones using a function. He said it was in the string.h library, but I checked and I don't see it. Can anybody point me in the right direction?
Asked
Active
Viewed 143 times
4 Answers
5
Can anybody point me in the right direction?
Look into the standard header ctype.h
.
Side note, most of them are usually implemented as macros, see Plauger.

cnicutar
- 178,505
- 25
- 365
- 392
-
Thanks! New to C so I am not sure about where to access all the libraries or what all of them even are. Appreciate the link. – Andy Feb 22 '12 at 22:06
1
The function isalpha
can help you out finding the rest of them.
char c;
scanf("%c", &c);
if (isalpha(c))
printf("You entered a letter of some alphabet\n");
-
-
@jørgensen is `isalpha` localized? For example if you enter an ascii-extended character like é, is `isalpha('é')` true? (I don't even know if you can do `'é'` ... XD) – Eregrith Feb 23 '12 at 08:43