I am getting an “undeclared identifier” error with the global variable addition to the Fahrenheit/Celsius exercise. I have looked at my code and it looks like it reads in the book. Any ideas? Thanks in advance.
//Declare a global variable float lastTemperature;
float fahrenheitFromCelsius(float cel)
lastTemperature = cel; float fahr = cel * 1.8 + 32.0; printf("%f Celsius is %f Fahrenheit\n", cel, fahr); return fahr;
Here is the second half of the code, as it is getting cut off in the forum tool:
[code]int main(int argc, const char * argv)
float freezeInC = 0; float freezeInF = fahrenheitFromCelsius(freezeInC); printf("Water freezes at %f degrees Fahrenheit\n", freezeInF); printf("The last temperature converted was %f\n", lastTemperature); return EXIT_SUCCESS;