The difference is that in one case the compiler is doing an implicit cast (I assume you get 12 from the first one) while in the second case it is taking the memory containing the floating point value and interpreting it as an int. It would help if you included what the actual output was.