#include <stdio.h>
void temperature(double x) {
double f = ((9.0/5)*(x))+32;
return f;
}
int main (int argc , char * argv[]){
printf("Please Enter a degree in Celsius =>");
if (argc > 1){
double c = atolf(argv[1]);
double result = temperature(c);
printf("%lf celcius in fahrenheit is %lf",c,result);
}
else {
printf("Please enter a temperature in degrees celius");
}
}
The error (when compiling in cygwin) i think the problem is in the void method temperature: i am trying to return a double value in the temperature method. Thanks for the help.
$ gcc -o temperature temperature.c
temperature.c: In function 'temperature':
temperature.c:6: warning: 'return' with a value, in function returning void
temperature.c: In function 'main':
temperature.c:15: error: void value not ignored as it ought to be