isspace -- White Space Test


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 charactern",
isspace(c) ? "is" : "is not");
if (c != 'n')
getchar(); /* Read the new line. */
}
}
RELATED FUNCTIONS
iscntrl
, isgraph
SEE ALSO
Character Type Macros and Functions