O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sizes and Ranges

The size of a data type refers to the amount of memory that it takes up. A bigger number will take more memory than smaller numbers. However, the smallest unit of memory available is a single byte, and sizes must be represented in multiples of bytes.

So a one-byte data type can store values that are limited to the number of variances that can be represented in a single byte of data. A character, for example, occupies one byte, allowing for up to 255 individual representations in the standard ASCII character set.

The actual amount of memory that a data type occupies can be established by using the built-in sizeof function. This returns a value that indicates the number of bytes occupied by the data type or a variable declared ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required