Data Types
Data Types
In the declaration of every variables it is mandatory to specify it data type.
It is representation of a data
Classification of data type
Basically three types
- Primitive
- Derived
- User-defined
1.Primitive Data types:-
- It is subdivided into sub data types
- Data we are storing with the help of the size of the data
- int
- char
- float
- void
2.Derived datatype:-
- Array
- String
- Pointer
- Functions
3.User-defined :-
- Stretcher
- Union
- typedef
- enum
The memory size of the basic data types may change according to 32 or 64-bit operating system.Let's see the basic data types.
| Data Types | Memory Size | Range |
|---|---|---|
| char | 1 byte | −128 to 127 |
| signed char | 1 byte | −128 to 127 |
| unsigned char | 1 byte | 0 to 255 |
| short | 2 byte | −32,768 to 32,767 |
| signed short | 2 byte | −32,768 to 32,767 |
| unsigned short | 2 byte | 0 to 65,535 |
| int | 2 byte | −32,768 to 32,767 |
| signed int | 2 byte | −32,768 to 32,767 |
| unsigned int | 2 byte | 0 to 65,535 |
| short int | 2 byte | −32,768 to 32,767 |
| signed short int | 2 byte | −32,768 to 32,767 |
| unsigned short int | 2 byte | 0 to 65,535 |
| long int | 4 byte | -2,147,483,648 to 2,147,483,647 |
| signed long int | 4 byte | -2,147,483,648 to 2,147,483,647 |
| unsigned long int | 4 byte | 0 to 4,294,967,295 |
| float | 4 byte | |
| double | 8 byte | |
| long double | 10 byte |
Comments
Post a Comment