On this page
isspace
Prev: isalpha | Up: ctype.h | Next: tolower
Rel: ctype.h, Arrays & C Strings
Ref: cppreference — isspace
Tags: #public #prog #c #stdlib #ctype #tier/core
Include
#include <ctype.h>
Signature & Overview
int isspace(int ch);
Returns non-zero for whitespace (' ', '\t', '\n', '\r').
Notes & Pitfalls
- Matches
' ','\t','\n','\r','\v','\f': Always cast(unsigned char)c.
Example
#include <assert.h>
#include <ctype.h>
int main(void) {
const char *p = " hello";
while (*p && isspace((unsigned char)*p)) p++;
assert(*p == 'h');
}
Linked from
Related notes
- tuts/c/stdlib/ctype/isalpha Linked here; links to this page; shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/tolower Linked here; links to this page; shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype Linked here; links to this page; shared tags: #c, #ctype, #prog, #stdlib
- tuts/c/fundamentals/arrays_and_strings Linked here; shared tags: #c, #prog
- tuts/c/stdlib/ctype/isdigit shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/static_assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/errno/errno shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/limits/CHAR_BIT shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/limits/DBL_EPSILON shared tags: #c, #prog, #stdlib, #tier