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

Unlock the full course today

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

Working with character conversions

Working with character conversions - C Tutorial

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

Start my 1-month free trial

Working with character conversions

- [Instructor] Most of the C type functions test for certain character types, such as uppercase, digits, spaces, and so on. These are the IS functions. A second set of C type functions is also available, those that modify characters. These aren't as numerous as the IS type functions, but they're quite handy. For example, the tolower function converts an uppercase letter to its lowercase counterpart. The toupper function does the opposite. Both functions take an integer as an argument and they return the modified character value as an integer. In this code I have a string defined at Line Six. It contains a mix of upper and lowercase text. The while loop at Line 10 walks through each character in the string, assigning it to integer variable CH. When the value of variable CH is equal to the null character, the loop stops. At Line 12, the putchar function outputs each character as modified by the tolower function. This function changes only uppercase letters A to Z. The value returned is…

Contents