![]() Chapter Contents |
![]() Previous |
![]() Next |
| isspace |
| Portability: | ISO/ANSI C conforming, UNIX compatible |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| CAUTION | |
| EXAMPLE | |
| RELATED FUNCTIONS | |
| SEE ALSO |
| SYNOPSIS |
#include <ctype.h> int isspace(int c);
| DESCRIPTION |
isspace
tests an integer value
c
to determine whether
it is white space; that is, a blank, tab, new line, carriage return, form
feed, or vertical tab character. In the 5370 and POSIX locales,
isspace
returns true only for standard white-space characters.
| RETURN VALUE |
isspace
returns 0 if the character is not white space, or a nonzero value if it is.
If the argument is
EOF
, 0 is returned.
| CAUTION |
The effect of
isspace
on a noncharacter argument other than
EOF
is undefined. Do not assume that
isspace
returns either 0 or 1.
| EXAMPLE |
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
main()
{
int c, n;
puts("Enter a character when prompted.. even spaces are OK.");
for (n = 1;; n++ ) {
puts("Enter now (q to quit): ");
c = getchar();
if (c == 'q') exit(0);
printf("The character you entered %s a space character\n",
isspace(c) ? "is" : "is not");
if (c != '\n')
getchar(); /* Read the new line. */
}
}
| RELATED FUNCTIONS |
| SEE ALSO |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.