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 |
|---|---|---|
| byte | 8-bit(1 byte) | 0 to 255 |
| sbyte | 8-bit(1 byte) | -128 to 127 |
| short | 16-bit(2 byte) | -32,768 to 32,767 |
| ushort | 16-bit(2 byte) | 0 to 65,535 |
| int | 32-bit(4 byte) | -2,147,483,648 to 2,147,483,647 |
| uint | 32-bit(4 byte) | 0 to 4,294,967,295 |
| long | 64-bit(8 byte) | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,8075 |
| ulong | 64-bit(8 byte) | 0 to 18,446,744,073,709,551,615 |
| float | 32-bit(4 byte) | -3.402823e38 to 3.402823e38 |
| double | 64-bit(8 byte) | -1.79769313486232e308 to 1.79769313486232e308 |
| decimal | 128-bit(16 byte) | (+ or -)1.0 x 10e-28 to 7.9 x 10e28 |
| char | 16-bit(2 byte) | Any valid single Character |
| bool | 8-bit(1 byte) | True or False |
| string | A sequence of characters | Any Word or sentance |
| DateTime | Represents date and time | click here to study in detail |
(Click Here, For more exercises)