... 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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.