# C Data Type Introduction

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 :-

## Case : 1

```char var = 'A';
```

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. ## Case : 2

```int var = 65;
```

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 :

```#include<stdio.h>
#include<conio.h>
int main( )
{
int x=65;
printf("%d\n", x);     // it will print a decimal integer 65
printf("%c\n", x);     //this will   print a character A
printf("%o\n", x);     //this will print octal number 101
printf("%x\n", x);     // this will  print hexadecimal number 41
return 0;
}
```

The output of the following code is :-

```65
A
101
41
```

As we can see, the same number works differently for programming purposes and programmers can manipulate this data in their own way.

## Data type in C has 2 broad categories ### Primitive Data type

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  :-

Type Size Format Specifier
char 1 %c
int 2 %d, %i
short 2 %d
long 4 %l, %ld
float 4 %f, %2f,
double 8 %e, %le
long double 10
bool
complex

### Secondary Data Type

The Secondary data type has further 2 more categories such as : 