The C/C++ function library has a rich and varied set of string- and character-handling functions. The string functions operate on null-terminated arrays of characters. In C, the string functions require the header <string.h> and the character functions use <ctype.h>. In C++, the string and character function headers are <cstring> and <cctype>, respectively. For ease of discussion, this chapter will use the C header names.
Because C/C++ has no bounds checking on array operations, it is the programmer’s responsibility to prevent an array overflow when working with strings. Neglecting this may cause your program to crash.
In C/C++, a printable character is one that can be displayed on a terminal. In ASCII environments, these are the characters between a space (0x20) and tilde (0xFE). Control characters have values between zero and 0x1F, and DEL (0x7F) in ASCII environments.
For historical reasons, the arguments to the character functions are integers, but only the low-order byte is used; the character functions automatically convert their arguments to unsigned char. Of course, you are free to call these functions with character arguments because characters are automatically elevated to integers at the time of the call.
The header <string.h> defines the size_t type, which is the result of the sizeof operator and is some form of unsigned integer.
C99 adds the restrict qualifier to certain parameters of several functions originally defined by C89. When this is the case, the function will be shown using its C89 prototype, which is also the prototype used by C++; but the restrict-qualified parameters will be pointed out in the function’s description.