Home / Tutorial / Programming / C / C ++ Programming Tutorial (Part 1) Data Type
c programming tutorial

C / C ++ Programming Tutorial (Part 1) Data Type

Mother Language is called Mother Language. The basic structure of all modern languages ​​is taken from C. Because, in C as well as at the very low level, it can work in memory address level, there are many high level coding options. There are many high-level features in the C to ease the user’s code and to ease the user’s trouble. One of the features of C language is the use of custom data type. This article presents custom data type key, what is the custom data type in C. and how it is used.

Basic concepts of custom data type

Custom data type is the user’s own data type. The user can create data type for his own convenience. We know that there are some built-in data types in C, such as: int, float, char etc. However, this build data type can not be worked well for many times. For example: write a program, whose job is to take roll number and grade input of 100 students of a class. Now need integer variables to roll number input. To take grade input again, the character type variables are needed (assuming the grade should be just one letter). Then the user will not declare 100 + 100 = 200 variables. Of course, arrays must be used in this case. But two types of variables need to declare two arrays. Custom variables can be used in such cases. If the user uses custom variables here, then all inputs can be taken with just one array. It looks like the work was done in the array. But if this type of program is for a bigger purpose, then it is not even with a simple array. For example: If this is the same thing, it is very difficult to do the job with a simple array if the need for input of the name, roll, grade, father’s name, phone number, age, and height of 50 students from 50 schools is required. Custom data type is used for such problems.

Custom data type

In C, a total of five new types of data types can be declared.


01. Structure: In this case, a hybrid data type is used using the built-in data types.

02. Bit-field: This is a different form of structure, through which the memory is worked on the bit level.

03. Union: This type of data type can be created in this method, which uses the same amount of memory for multiple fields.

04. Enumeration: The value of the data types created in this method is determined by a symbol list.

05. Typedef: In this process, the new name of the custom or the custom data type can be determined.

Here are some advantages and disadvantages of each approach. Again all the work is not the same type. For example, the end data type does not build a custom type with the new data, but instead makes another as a custom type by the new name. Here again, the bit-field is the only method, which can be done at the lower level. The structure will be discussed first.

About Admin

Leave a Reply

Your email address will not be published. Required fields are marked *