In C programming Language data types are the keywords that determines the type of data to store or manipulate. Three categories of data types in C programming Language.
- Basic Data Types
- Derived Data Types
- User-defined Data Types
1. Basic Data Types
Basic Data types are the fundamental data types in C programming language. They are the built-in data types provided by the C Language. There are four types of data types Integer, Floating, Character and Void.
i. The integer data type:
The integer data type (int for short) is used for integer numbers i.e …-3, -2, -1, 0, 1, 2, 3 …
Syntax for integer data type:
ii. The floating data type:
The floating data type (float for short) is used for fractional numbers i.e ..-3.4, 2.2.. etc.
Syntax for float data type:
iii. The character data type:
The character data type (char in short) is used for characters like a, b, c, d…..etc.
Syntax for char data type:
iv. The void data type:
The void data type is also an empty data type. It means “nothing” or “no type”. It is used to indicate that no value is available.
2. Derived Data Type
The data types that are derived from basic data types are called as derived data type. There are three types of derived data types functions, arrays and pointers.
Functions are the block of statements grouped together to perform specific tasks.
Arrays are the collection of homogenous data types.
Pointer is a variable that stores the memory address of another variable.
3. User-defined Data types:
User-defined data types are those data types that are created by user as per their requirement using available resources. There are three types of user-defined data types Structure, Union and Enumeration.
i. Union and Structure:
They are the user-defined data type that can be created by using different basic data types.
An enum is a user-defined type consisting of a set of named constants called enumerators.
Following table represents the storage size and range of the integer data type.
Following table represents the storage size, range and precision of the Floating data type.