Program to delete duplicates from a link list

What is type conversion in C

 What is type conversion in C :-
                              Type conversion is the process of converting data of one type into another type there are two type of type conversion possible in c- program given as below:-
1) Implicit type Conversion (Automatic Type conversion ):-
                                                                                               
(i) It is automatic done by the system internally without programmer intervention.
ii) Usually in a mixed operands expression all the lower data type are converted to the highest data type in the expression .
Example:-
#include<stdio.h>
int main()
{
   int x=10;
   float y=5.3;
   double z;
   z=(x*5+y*2.6);
   printf("%lf",z);
   return 0;
}

 

Here all the variable x and y are converted into double  because we are storing the result in to z which is type of double .
Example 2 :
#include<stdio.h>
int main()
{
    int x;
    char y='a';
    x=y; // x will be 97
    return 0;
}

in above example int is higher data type then char so character will be converted into integer type and ascii value of ‘a’ will be store in x.

2) Explicit type Conversion (Type Casting ):-
                                                                        It is specially written by the programmer in his code.

Syntax:-  

 

Example:-
#include<stdio.h>
int main()
{
   float x;
   int y;
   y=10/3;
   x=(float)10/3;
   printf("y= %dn",y); //y=3
   printf("x=%fn",x); // x=3.33333
   return 0;
}

Recommended Post:

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

 

Leave a Reply

Your email address will not be published.