what is typecasting?

Type casting allows us to convert one data type into other. In C language, we use cast operator for type casting which is denoted by (type).

Without Type Casting:
int f= 9/4;
printf("f : %d\n", f );//Output: 2

With Type Casting:
float f=(float) 9/4;
printf("f : %f\n", f );//Output: 2.250000

Example :-

int main(){
float f= (float)9/4;
printf("f : %f\n", f );
return 0;
}





Previous Next

Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here


Ittutorial