Chapter 2. Variables and Basic Types

CONTENTS

Section 2.1 Primitive Built-in Types 34

Section 2.2 Literal Constants 37

Section 2.3 Variables 43

Section 2.4 const Qualifier 56

Section 2.5 References 58

Section 2.6 Typedef Names 61

Section 2.7 Enumerations 62

Section 2.8 Class Types 63

Section 2.9 Writing Our Own Header Files 67

Chapter Summary 73

Defined Terms 73

Types are fundamental to any program. They tell us what our data mean and what operations we can perform on our data.

C++ defines several primitive types: characters, integers, floating-point numbers, and so on. The language also provides mechanisms that let us define our own data types. The library uses these mechanisms to define more complex types such as variable-length character ...

Get C++ Primer, Fourth 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.