Section 1.3 of Kernighan and Ritchie uses the following temperature conversion program to introduce For statements:
#include <stdio.h>
/* print Fahrenheit-Celsius table */
int main(){
int fahr;
for (fahr = 0; fahr <= 300; fahr = fahr + 20)
printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr-32));
}
What it doesn't explain is how this program can make use of an int variable to produce float values without an error. What makes this valid? Don't all the variables in an equation have to be of the same type? I'm hesitant to move forward without understanding this.