Type Casting in C
In this tutorial, We will learn to typecast in the C programming language.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
In this tutorial, We will learn to typecast in the C programming language.
Introduction
Typecasting is a way to convert a variable from one data type to another data type.
Example: Typecast Integer datatype into Float datatype in C.
/*
* C program to typecast integer datatype into float datatype
*/
#include <stdio.h>
int main()
{
int var_integer = 5;
float var_float = (float) var_integer; // typecasting int into float
printf("%f\n", var_float);
return 0;
}
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Comments
Post a Comment