Advertisements
Advertisements
Question
Enlist different built-in data types in C++ with their size.
Very Long Answer
Advertisements
Solution
Built-in Data Types in C++ and Their Sizes:
| Data Type | Size (in Bytes) |
| char/signed char/unsigned char | 1 |
| int/signed int/unsigned int | 2 |
| short int/signed short int/unsigned short int | 2 |
| long int/unsigned long int | 4 |
| float | 4 |
| double | 8 |
| long double | 10 |
| void | 0 (No value/size) |
- The Modifiers: The text explains that
signed,unsigned,long, andshortare modifiers applied to the basic types (intandchar) to change their range or size. - The “void” type: While listed as a built-in type in Figure 3.1, it is used for functions that do not return a value and therefore does not have a size in bytes listed in the table.
- Compiler Context: The table shows
intas 2 bytes. This is typical for older 16-bit systems (like Turbo C++). In most modern 32-bit or 64-bit systems, a standardintis usually 4 bytes.
shaalaa.com
Is there an error in this question or solution?
2025-2026 (March) Official Board Paper
