I was working on this program and I noticed that using %f for a double and %d for a float gives me something completely different. Anybody knows why this happens?
It has to do with internal representations of data. You are trying to print a float as if it is an int, which has a completely different internal (binary) representation.
The double case is similar. You probably have garbage (any data) after the float variable. That garbage is interpreted as part of the double value.