Type conversion :-
Type conversion is a process of converting data of one type into another type there are two type of the type conversion in C-programming.
1) Implicit type conversion (Automatic type conversion):-
It is automatically done by the system internally without programmer intervention. Usually in a mixed operand expression all the lower data type are converted to the higher data type in the expression.
example:-
#include<stdio.h>
int main()
{
int x=10;
float y=5.5;
double z;
z=(x*5+y*2.3);
printf("Value of Z is %lf",z);
return 0;
}
In this example all the values are converted into double automatically by the system.
2) Explicit Type conversion:-
It is specifically written by the programmer in his code.
Example:-
#include<stdio.h>
int main()
{
int x;
float y;
x=10/3;
y=(float)10/3; // Type conversion
printf("x=%d \n",x);
printf("y=%f",y);
return 0;
}
Recommended Post:
Hackerearth Problems:-
- Very Cool numbers | Hacker earth solution
- Vowel Recognition | Hackerearth practice problem solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem
Hackerrank Problems:-
Data structure:-
- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree
Key points:-
- How to set limit in the floating value in python
- What is boolean data type
- How to print any character without using format specifier
MCQs:-
0 Comments