Sometimes, the basic set of data types defined in the C language such as int, float, char, double etc. may not be insufficient for our program. Under such circumstances we can create our own data types based on primary data types
There are mechanisms for doing this in C:
Using : typedef
Using : Stucture
Using : Union
Using : Enum
They are all known as User as well as Member define data type because user can amend according to their requirement.
Use Of typedef :-
The purpose of typedef is to assign alternative names/ alias name to an existing types. Sometime standard declaration is confusing, or likely to vary from one implementation to another.
Use Of Structure :-
Structure is data type available in C that allows to combine data items of different kinds. To define a structure, you must use the struct statement. Structure is a collection of variables of different types under a single name.
Use Of Union :-
A union is a special data type available in C that allows to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time.
Use Of Enum :-
Enumeration (or enum) in C. Enum is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain. enum State {Working = 1, Failed = 0};
Note: Next we will discuss about all in detail