Datatype
A data type is a type of data. Of course, that is rather circular definition, and also not very helpful. Therefore, a better definition is Datatype is a classification that specifies type, size, range alloted for value. Some common datatypes include int, string, char, string, bool. Below are the datatypes with their respective size and range.
| Datatype | Size | Range |
|---|---|---|
| short | 16-bit(2 bytes) | -32,768 to 32,767 |
| unsigned short | 16-bit(2 bytes) | 0 to 65,535 |
| signed short | 16-bit(2 bytes) | -32,768 to 32,767 |
| int | 32-bit(4 bytes) | -2,147,483,648 to 2,147,483,647 |
| unsigned int | 32-bit(4 bytes) | 0 to 4,294,967,295 |
| signed int | 32-bit(4 bytes) | -2,147,483,648 to 2,147,483,647 |
| long | 64-bit(8 bytes) | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,8075 |
| unsigned long | 64-bit(8 bytes) | 0 to 18,446,744,073,709,551,615 |
| signed long | 64-bit(8 bytes) | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,8075 |
| float | 32-bit(4 bytes) | -3.402823e38 to 3.402823e38 |
| double | 64-bit(8 bytes) | -1.79769313486232e308 to 1.79769313486232e308 |
| char | 8-bit(1 byte) | Any valid single Character |
| bool | 8-bit(1 byte) | True or False |
| string | A sequence of characters | Any Word or sentance |
(Click Here, For more exercises)