Forced conversion : Data Type Cast « Data Type « C Tutorial






Forced conversion occurs when you are converting the value of the larger data type to the value of the smaller data type

When floating points are converted to integers, truncation occurs.

#include <stdio.h>

main()
{
    double f1 = 12.23456;

    printf("%d \n", (int)f1);
}
12








2.31.Data Type Cast
2.31.1.Type conversion
2.31.2.Forced conversion
2.31.3.Type casting
2.31.4.Data type cast: from int to float