Datatypes specify the “size“, “type of data” and the “maximum range” of value that an object can accommodate.
Object – An object is a named region of storage. It might be a variable or array or structure instance.
Classification of datatypes
Data types are classified into two types:
- Basic datatypes
- Derived datatypes
Basic data types can represent values such as characters, Integer and decimal-point types.
- Characters can be represented by using char datatype (Ex: a, b, c, d, f etc)
- Integer values through int datatype. ( Ex: 100, 234, 456, etc)
- Decimal point values through the float and double datatypes (3.5, 7.5456, 878.00232, etc.)
char also belongs to integer family. Because characters are represented using their ASCII values (Integer values).
Derived data types are constructed from the basic datatypes.
- Arrays – Sequence of objects of the same type under a single name.
- Functions – Returns an object of the specified type.
- Pointers – Points to an object of a given address.
- Structures – Objects of different types under a single name.
- Unions – Contain any one of the objects of different types at the same time.
I just gave a brief introduction to all the data types. We will see more in detail about data types in our further articles.