Compiler Error
I don't remember if I have messed with C since I put Mavericks on the computer, but I have started getting the following error when I compile, cc or gcc:
temp.c:6:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main(void)
^~~~
1 warning generated.
This warning showed up today. I do remember some type of warning when I used cc rather than gcc in the past, however, when using gcc, I things went smoothly, no warnings.
The code is from KR Temperature program:
#include <stdio.h>
/* print Fahrenheit-Celsius table
for fahr = 0, 20, ..., 300 */
main(void)
{
int fahr, celsius;
int lower, upper, step;
lower = 0; /* lower limit of temperature table */
upper = 300; /* upper limit */
step = 20; /* step size */
fahr = lower;
printf("Fahr\tCel\n");
while (fahr <= upper) { /* While loop */
celsius = 5 * (fahr-32) / 9;
printf("%d\t%d\n", fahr, celsius);
fahr = fahr + step;
}
}
/* NOTE: {} and ; are separator character tolkens */
/* <= is a compound operator tolken */
MacBook Pro, OS X Mavericks (10.9.2)