Typecasting in C
Typecasting is also known as "forced conversion".
It refers to changing variable one data type to another data type.
Typecasting in can be certified into following two types: -
1) Implicit type casting.
2) Explicit type casting.
Implicit type casting: -
It is also known as "Automatic type conversion".
It is done by compiler on its own without any external trigger from user.
Generally takes place when in an expression more than one data type is present in such condition. Type conversion take places to avoid data lose.
Example: -
#include<stdio.h>
main()
{
char y = 'a';
int b = y;
printf("%c",y);
printf("%d",b);
}
Explicit Type casting: -
This process also called 'Type casting' and it is user defined. Here the user can type cast the result to make it of particular data type.
Example: -
Online learning is an educational mode allowing students to take part in different courses and programs using the internet. In online tuition, students don't need to waste their time going to the lecture halls or classrooms, rather they can decide to learn whatever from any part of the world. For online tuitions you can call - +91-9654271931.
ReplyDeleteOnline learning is an educational mode allowing students to take part in different courses and programs using the internet. In online tuition, students don't need to waste their time going to the lecture halls or classrooms, rather they can decide to learn whatever from any part of the world. For online tuitions you can call - +91-9654271931.
ReplyDelete