Data types


Data Types in c

The data types define the types of data stored in a memory location.
Data types specify how we enter data into our programs and what type of data we enter.

Responsive image

int

An int is a keyword which is used to define integers in c language , usinig int keyword the programmer can inform the compiler that the data associated with this keyword should be treated as integer .
The size of int is 2 , 4 or 8 bytes and is machine deendent .
It supports three different sizes of integer data types
Note:-
here short and long are called types qualifiers.
to know the size of any data type we use the sizeof operator .

The size and range of integer varies from machine to machine and compiler to compiler

Data typesSize(bytes)Range
int or signed int2-32,768 to 32767
unsigned int20 to 65535
short int or signed short int1-128 to 127
unsigned short int10 to 255
long int or signed long int4-2,147,483,648 to 2,147,483,647
unsigned long int40 to 4,294,967295



Float

A float is a keyword which is used to define floating point numbers. Using float keyword programmer can inform to compiler that the data associated with this keyword should be treated as floating point number.

double

A double is a keyword which is used to define long floating point number .using double keyword programmer con inform to compiler that the data associated with this keyword should be treated as logn floating point number.

Data typesSize(bytes)Range
float43.4E-38 to 3.4E+38
double81.7E-308 to 1.7E+308
long double103.4E-49 to 127

char

char is a keyword which is used to define a single character or a sequence of characters(called string) in c . Using char keyword programmer can inform to compiler that the data associated with this keyword should be treated as character.
Data typesSize(bytes)Range
char or signed char1-128 to 127
unsigned char10 to 255

void

is a empty data type since no value is associated with this data type it does not occupy any space in the memory .it is not associated with any variable except pointers it is normally use with function , we will discuss letter .