Chapter 15: Working with Strings
In C, a string is an array with two special properties. First, a string is made up of only characters. Second, the string must conclude with an essential terminating character – the NUL
character. While some would say strings are one of C's weakest features, I disagree with that assessment. Because strings build on already-established mechanisms, I believe that they are rather elegant in an unexpected way.
Not all values that we might want to manipulate in a program are numbers. Often, we need to manipulate words, phrases, and sentences; these are built from strings of characters. We have been getting output using simple strings in printf()
statements. To input strings and numbers, we need to be able to manipulate strings even further so that we can convert them into values. In this chapter, we will explore the elements and building blocks of C strings, as well as various ways to use and manipulate C...