मराठी

Type Modifiers

Advertisements
Maharashtra State Board: Class 11

Type Modifiers

The integer constant occupies 2 bytes (16 bits) in memory for 16 bit machine C++ has three classes of integer storage, namely short integer, integer, and long integer. Short and long are also called modifiers. It control over the range of numbers and the storage space

  • Short integers represent fairly small integer values and require half the amount of storage
  • Long integers requires twice the space in memory than that of ordinary integers 
Type  Size (bits) Range
integer 16 - 32768 to 32767 
(i.e.-215 to 215 -1) 
short integer 8 -128 to 127
(i.e.-27 to 27 -1) 
long integer  32 -2,147,483,648 to
2,127,483,647 
(i.e.-231 to 231 -1) 

1) Integers, signed and unsigned 
The integer constants will always be positive. In such a case unsigned form of integer constant can be used
The range of unsigned integers is from 0 to 65535 (i.e., from 0 to 216 - 1).

Type  Size (bits) Range 
unsigned integer  16 0 to 65535 
(i.e., from 0 to 216 - 1)
unsigned short integer 8 0 to 255
(i.e., from 0 to 28 - 1)
unsigned long integer 32 0 to 4, 294, 967, 295
(i.e., from 0 to 232 - 1)

2) Characters, signed and unsigned 
Characters are usually stored in one byte (8 bits) of internal storage. Character can have values from -128 to 127 (i.e., -27 to 27 -1) 
In the case of unsigned characters, this range gets increased from 0 to 255 (i.e., 0 to 28 -1)

3) Floats and doubles
Floating points or real numbers are stored in 4 bytes (32 bits) of memory. The range of floating numbers is from -3.4e38 to 3.4e38
If this is insufficient, then C++ offers a double data type. It occupies 8 bytes (64 bits) in memory and has a range of -1.7e308 to 1.7e308. 

Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×