Unions, Enumerations, and Bit Fields

This section is going to be relatively short. It discusses three ideas related to naming program entities for the programmer's convenience. The first idea is to define a variable that can be used to store information of more than one type, for example, an integer and a floating point number. This is the idea of a union. The second idea is to define symbolic names for related constants without getting into details of assigning numerical values to these symbolic constants. This is the idea of enumeration. The third idea is naming parts of the word so that they can be manipulated separately from the rest of the word. This is the idea of bit fields.

C++ implements these ideas in a similar manner to defining ...

Get Core C++ A Software Engineering Approach 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.