In this tutorial, we will study different data types in c programming. So let us start.
What are data types in c programming?
A Data type defines the type of variable define and function definitions. Whenever a program is run on a computer there is some amount of memory that is needed and this memory is received with the help of data types. The data types tell us the type of value. Some of the common data types are integers, floating-point numbers, characters, strings, and arrays. They may even include specific types such as dates, timestamps, boolean values, etc.
What are the types of data types in c programming?
There are basically two types of data types- predefined and user-defined. These two types can be further classified into various categories as shown below. The predefined data type can be further classified into character, integer, float, double, and void. And the user-defined can be classified into an array, pointer, structure, union, and function, etc.
Predefined Data Type
The data type that is already defined in the C library is known as the Predefined data type. The predefined data type is also known as a primary, primitive data type.
What are the types of pre-defined data types?
This is represented as a single character in the keyword chart. The Storage size of the character is 1-byte and the Value range is-128 to 127 or 0 to 255.
Integer can be seen as a number that can be written without a fractional component. It is a whole number whose storage size is 2 or 4 bytes and the Value range is -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647.
These are the data types that are used to represent the floating-point numbers. The Storage size is 4-byte and the Value range is from 1.2E-38 to 3.4E+38.
It is similar to the float data type. The only difference is that in the float data type there are 6 digits which can be stored in 4-bytes and the Double data type has 14 digits that can be stored in 8-byte.
The meaning of the term void is that the value is not available.
User Defined Data Type
The data types in the C library that were not defined earlier and are added by the user are known as the user-defined data type. The user-defined data type is also known as the secondary and Non-primitive data type. There are different types of user-defined data types such as Array, Pointer, Structure, Union, Function, etc.