type conversion in c

the process of converting a data or value from one data type to another data type is called type conversion.

type conversion is done in two ways 1)implicit type conversion 2)explicate type conversion (or) type casting

1)Implicit type conversion

In this the value from the smallest data type is copied to the largest data type. During this conversion no data will be lost .

syntax:

destination_var=source_var;

example:

#include
main ()
{
int a=10;
float f ;
f=a;
printf("the value of f is %f",f);
}
2)Explicit type conversion (or) Type casting

here,the value of largest data type is copied to smallest data type. During this process the data may be lost .

syntax:

destination_var=(destination_data_type)source _var;

example:

#include
main ()
{
int a;
float f=3.23423 ;
a=(int)f;
printf("the value of a is %d",a);
}