## Data type

look at the following table

Name Beginning letter of the name Roll number Height
Hasibul Hassan Santo H 01 5.4
Rabiul Awal R 02 5.6
Sharif S 03 5.4

Here name is string type or set of character type data.Beginning letter of the name is character type data.Roll is integer or whole number type data Height is fraction type data

Thus data type simply means which type of data.
How to convince compiler different data type?
We have to use keyword to convince compiler a data type. For example you should use int instead of integer to convince compiler a whole number.

## Variable

Variable is like a container. let us consider an example. Say we want to add two number by a program. First we have to store two number then we can add. To store two numbers  we need two containers. This container is called variable. Variable is a memory space to contain an information.
How to declare a variable:
General syntax of declaring a variable: Data type variable_name;
Here data type is keyword and variable name is the name of memory. Let you want to declare a variable where name is memory and type is integer. You should write it as follows:
int memory;

Variable name can be any user defined name but full-fill the following rules:

• Any character from a to z  or  from A to Z can be used.
• digit can be use but not at the beginning. i.e: memory1 is valid but 1memory is not valid
• keyword can not be used. i.e: int float; is invalid because float is a keyword.
• under score can be used but not space. i.e: a b is invalid but a_b is valid

### Syntax for declaring more than one variable:

data type variable1,variable2,variable3,….variableN;
example: int a,b,c;

### What actually happen while declaring a variable?

Memory space will be created after declaring a variable. for example if you write

`int a;`

4 bytes memory will be created under a 32 bit operating system. To see the evidence run the following code:

```#include<stdio.h>
int main()
{
int a;
printf("memory space for a = %d",sizeof(a));
return 0;
}```

## OUTPUT

memory space for a = 4

Explanation:
printf() function prints a message but when there is a %d in the message it starts to find a memory to print the value of this memory. In our example print message is: memory space = %d”,sizeof(int)
Here sizeof() is a library function of C program. It returns the size of memory in byte and %d catch this value. For my 32-bit operating computer sizeof(a) returns 4 and it is caught by %d. Thus memory space = %d”,sizeof(int) is converted as
memory space = 4″

You will get the same result if your operating system is also 32-bit. If your operating system is 64-bit you get memory space = 8 as output.

Memory space for all variable is not constant. Here is the list of memory space for different data type.

Data type keyword for Data type Memory in byte Memory in bit
character char 1 8
integer int 4 32
fraction float 4 32
fraction double 8 64

*We consider 32-bit operating system. It will be two times for 64-bit operating system