Monday, 6 January 2014

Explain data types in C

Data types 
They are used to define  variables before its use.As per need different data types are used in C.
For example
a)int is used to define integer numbers
int count;
b)float is used to define floating point numbers
float miles;
c)double is used to define big floating point numbers,it reserves twice the storage for numbers.
double atoms;
d)char defines character
char letter;
These are common data types.Others are short,long,signed,unsigned.
short int<int<long int
float<double<long double
signed and unsigned
when a variable is declared as unsigned then negative range of data type is declared as positive.
unsigned long int c;
Memory size of different data types
short integer occupies memory of 2 bytes
long integer occupies memory of 4 bytes
signed and unsigned integer occupies memory of 2 bytes
float occupies memory of 4 bytes
double occupies memory of 8 bytes
character occupies memory of 1 byte

No comments:

Post a Comment