... element (8)—resulting in the number of elements in numbers (20).

Determining the Sizes of the Fundamental Types, a Built-In Array and a Pointer

Figure 8.14 uses sizeof to calculate the number of bytes used to store many of the standard data types. The output was produced using the default settings in Xcode 7.2 on Mac OS X. Type sizes are platform dependent. When we run this program on Windows, for example, long is 4 bytes and and long long is 8 bytes, whereas on our Mac, they’re both 8 bytes.

Fig. 8.14 sizeof operator used to determine standard data type sizes.

Alternate View

 1   // Fig. 8.14: fig08_14.cpp
 2   // sizeof operator used to determine ...

Get C++ How to Program, 10/e 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.