Second Program in C
Welcome back friends, today we will continue with Datatypes and Variables.
Datatypes: we need to first identify the type of data to store the data in C program.C language
provides four basic datatypes such as char,int,float and double.
DataType Type of Data Memory
Int Integer Type 2 bytes
Char Character Type 1 byte
Float Floating Point Numbers 4 byte
Double Floating Point Numbers with 8 byte
higher precision
Variables:A variable is a dataname used for storing a data value.It also called as memory allocators
which is used to allocate the memory for any data value in system.It can store single value at a
time.A variable can be assigned different values at different times during the program execution.
For example: marks,sum,add etc…
But there are some rules to declare variables :
1.A variable must begin with a character or an underscore(_) without any spaces.
2.The variable should not be a C keyword.
3.The variable should not be start with a digit.
4.We cannot use blank spaces and commas with in a variable name.
As we know we will have to declare the variable to store data.Before declaring variable name we will
have to mention the type of data so that variable is able to store the data of the given type. For
example: int num;
Lets take an example: