devxlogo

Standards Provide Guarantees Regarding the Sizes of Integral Types

Standards Provide Guarantees Regarding the Sizes of Integral Types

Char, short, int, and long have implementation-defined sizes. However, Standard C and C++ provide a few guarantees about their sizes. Both standards guarantee that char has at least 8 bits, and that it is not larger than short. Short may not be larger than int and it must occupy at least 16 bits. Long must be at least as large as int and it occupies no less than 32 bits.

devx-admin

Share the Post: