Type Casting


Prev Tutorial Next Tutorial

Type Casting

Type casting is process to convert a variable from one data type to another data type. For example if we want to store a integer value in a float variable then we need to typecast integer into float.

Type Casting

Example

#include <stdio.h>
#include <conio.h>

void main()
{
int a,b;
float sum;
clrscr();
printf("Enter two no. ");
scanf("%d%d",&a,&b);
sum=a+b;
printf("Sum: %f",sum);
getch();
}

Output

Type Casting
Prev Tutorial Next Tutorial

Advertisements




Facebook Likes

Advertisements