C examples for Data Type:Type Cast
Type conversions can be classified into two categories.
Here is one more example of implicit type conversion (assume counter to be the int variable):
#include <stdio.h> int main()/*from w w w . j a va 2 s . c o m*/ { int counter = 14.85; /* L3, OK, now value of counter is 14 */ printf("%d", counter); return 0; }
Here is one more example of implicit type conversion:
#include <stdio.h> int main()// w w w . j av a 2 s.co m { double d = 2/4.0; /* L4, OK, now value of d is 0.500000 */ printf("%f", d); return 0; }