![]() Chapter Contents |
![]() Previous |
![]() Next |
| isalpha |
| Portability: | ISO/ANSI C conforming, UNIX compatible |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| CAUTIONS | |
| EXAMPLE | |
| RELATED FUNCTIONS | |
| SEE ALSO |
| SYNOPSIS |
#include <ctype.h> int isalpha(int c);
| DESCRIPTION |
isalpha
tests an integer value
c
to determine whether
it is an alphabetic (uppercase or lowercase) character. In the C locale,
isalpha
returns true only for the characters
for which
isupper
or
islower
is true.
| RETURN VALUE |
isalpha
returns 0 if the character is not alphabetic, or a nonzero value if it is
alphabetic. If the argument is
EOF
, 0
is returned.
| CAUTIONS |
The effect of
isalpha
on a noncharacter argument other than
EOF
is undefined. Do not assume that
isalpha
returns either 0 or 1.
| EXAMPLE |
#include <ctype.h>
#include <stdio.h>
#define MAXLEN 40
main()
{
char id[MAXLEN+1];
int i;
char *text;
char input[MAXLEN];
puts("Enter a string (40 characters maximum). ");
text = gets(input);
puts("Initial alphabetic characters you entered:");
for (i = 0; i < MAXLEN && isalpha(text[i]); i++) {
id[i] = text[i];
putc(id[i]);
}
id[i] = '\0';
putc('\n');
}
| RELATED FUNCTIONS |
| SEE ALSO |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.