From the course: C: Data Structures, Pointers, and File Systems

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Testing characters

Testing characters - C Tutorial

From the course: C: Data Structures, Pointers, and File Systems

Start my 1-month free trial

Testing characters

- [Narrator] The C library comes with a host of functions to test characters, determining their type or category. These are often called the C-type functions after the header file name ctype.h. Those C-type functions that test characters are often referred to as the IS functions because their names begin with the letters I and S. These functions return zero or false when the test fails and they return a non-zero or true value otherwise. Here are some common character-testing functions. For example isalpha tests to determine whether a character is alphabetic, A to Z, upper- or lower- case. Isdigit returns true for number characters zero through nine. Isupper and islower returns true for upper- and lower-case letters respectively. And here are some more C-type functions. Your compiler's C-library may support some or all of these or even more. In this file I've written a test string declared at line six. It contains a smattering of characters. A while loop at line 10 plows through the…

Contents