6. Adding Words to Your Programs

In This Chapter

Understanding the string terminator

Determining the length of strings

Using character arrays: listing characters

Initializing strings

Although C doesn’t have string variables, you do have a way to store string data. This chapter explains how. You already know that you must enclose string data in quotation marks. Even a single character enclosed in quotation marks is a string. You also know how to print strings with printf().

The only task left is to see how to use a special type of character variable to hold string data so that your program can input, process, and output that string data.

Understanding the String Terminator

C does the strangest thing to strings: It adds a zero to the ...

Get C Programming Absolute Beginner’s Guide, Third Edition 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.