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 - C Tutorial
From the course: C: Data Structures, Pointers, and File Systems
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Using single character I/O4m 4s
-
Testing characters2m 34s
-
Working with character conversions2m 17s
-
Understanding strings in C3m 3s
-
Fetching string input3m 18s
-
Sending string output2m 46s
-
Reviewing printf() placeholders3m 8s
-
Using printf() placeholders3m 36s
-
Exploring string functions3m 29s
-
Manipulating strings3m 53s
-
Avoiding string problems2m 27s
-
Challenge: String I/O and manipulation1m 46s
-
Solution: String I/O and manipulation2m 16s
-
-
-
-
-