CHAPTER 7

Characters and String Handling

Handling characters and sequences of characters with computers is one of the very important activities. Sequences of characters are generally referred to as strings. In C, strings are written within a pair of double quote marks (“) and are stored in the form of character arrays with a null character (\0) as it 's last element. This null character will be automatically inserted by the C compiler. For example, “World Cup” is a string and is stored as shown in the following figure.

images

We have been using character arrays or strings right from the very first example to display messages along with the printf()

Get Programming Techniques Through C: A Beginner's Companion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.