C examples for Data Type:Type Cast
The following code shows how to cast int to float type.
#include <stdio.h> int main(void) /* print i and i/2 with fractions */ { int i;//from w w w . ja v a 2 s .com for (i = 1; i <= 100; ++i) printf("%d / 2 is: %f\n", i, (float)i / 2); return 0; }