Home » Uncategorized » Typecasting in C

Typecasting in C

This tutorial portrays an example code for typecasting in C. Typecasting is necessary to force conversion in C.

#include <stdio.h>

int main(int argc, char **argv) {
	int j;
	float k = 32.89;

	j = (int)k; //typecase from float to interger
	printf("j = %d\n", j); // typecasting in necessary to force conversion

	return 0;
}

We hope this tutorial is of help. In case you have any other suggestions or questions, do let us know in the comments!


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment