I just started learning C and I'm having trouble understanding why the following code even works at all:
void convertMyNumber (float myValue) {
int myNewValue = floor(myValue * 100);
printf("%d", myNewValue);
}
Looking at the documentation for math.h, it is stated that the floor() function takes a double as an argument, and also returns a double. So far so great, I just ran the above code and typed in 576.73 as the value for the myValue variable. Surprisingly (to me), it printed out exactly 57673 on the screen, and I'm finding it difficult to understand how it is possible that it was able to attribute the returning value of the floor function (a double) to int myNewValue.