Summary - 图1Summary

This has been a short, but powerful chapter. You learned about character arrays that hold strings. Even though C++ has no string variables, character arrays can hold string literals. After you put a string in a character array, you can print or manipulate it as if it were a string.

Chapter 5 ♦ Character Arrays and Strings

Starting with the next chapter, you begin to hone the C++ skills you are building. Chapter 6, “Preprocessor Directives,” introduces preprocessor directives, which are not actually part of the C++ language but help you work with your source code before your program is compiled.

Summary - 图2

Summary - 图3Preprocessor Directives

As you might recall from Chapter 2, “What Is a Program?,” the C++ compiler routes your programs through a preprocessor before it compiles them. The preprocessor can be called a “pre-compiler” because it preprocesses and prepares your source code for compil- ing before your compiler receives it.

Because this preprocess is so important to C++, you should familiarize yourself with it before learning more specialized com- mands in the language. Regular C++ commands do not affect the preprocessor. You must supply special non-C++ commands, called preprocessor directives, to control the preprocessor. These directives enable you, for example, to modify your source code before the code reaches the compiler. To teach you about the C++ preprocessor, this chapter

  • Defines preprocessor directives

  • Introduces the #i ncl ude preprocessor directive

  • Introduces the #def i ne preprocessor directive

  • Provides examples of both

Chapter 6 ♦ Preprocessor Directives

Almost every proper C++ program contains preprocessor di- rectives. This chapter teaches you the two most common: #i ncl ude and #def i ne .