September 1998
Intermediate to advanced
848 pages
20h 13m
English
Chapter 7, "C Control Statements: Branching and Jumps," introduced the ctype.h family of character-related functions. These functions can't be applied to a string as a whole, but they can be applied to the individual characters in a string. Listing 11.26, for example, defines a function that applies the toupper() function to each character in a string, thus converting the whole string to uppercase. It also defines a function that uses ispunct() to count the number of punctuation characters in a string.
/* convert.c -- modifies a string */ #include <stdio.h> #include <string.h> #include <ctype.h> #define LIMIT 80 void ToUpper(char *); int PunctCt(const char ... |
Read now
Unlock full access