Before going deep down in C , first we have to understand what is data type exact? As we know that machines only understand machine language, which follows the binary number system to represent voltage signals.
Now, the question arises how will machines understand these high level built-in datatypes?
So, the answer is every high-level programming language provides some functionalities or a procedure, which tells the compiler how the programmer intends to use or manipulate the data and these functionalities are called data types.
Okay, let’s understand this more clearly :-
Since, we know that C programming uses ASCII character set to store values in memory locations.Every character is stored in the form binary number system in memory. That means the first character converted to the ASCII value and further this ASCII value converted to the binary number system and the resulting binary number system will be stored in memory.
We know that the ASCII value of character 'A' is 65, so the character first converted into 65 and then 65 further converted to the binary number which is 01000001 and this will be stored in memory.
We don't need to convert integers to ASCII value and further ASCII value to the binary number system.The integer directly converted to the binary number system.
The binary representation of 65 is 01000001 and this will be stored in memory.
In both the above cases the resulting binary number is the same. That means for machines these two values ‘A’ and 65 are the same But for programmers both are different values; ‘A’ is a character and 65 is an integer value.
For machines every type of data is a sequence of binary numbers.
Which means, data types is a functionality of high level programming through which the programmer can manipulate the data in different different ways and gives range, size of data and the type of data that can be stored in a variable.
For example :
The output of the following code is :-
As we can see, the same number works differently for programming purposes and programmers can manipulate this data in their own way.
The first category of data type is built-in data type, which are also known as primitive data type or concrete datatype or fundamental data type. Which are listed below along with their size and ranges :-
The Secondary data type has further 2 more categories such as :