printf("\nHi dear, my name is Farah.\n");
printf("\nFor the depth of %d km, the temperatures are: ", depth);
printf("\n%.2f degrees Celsius or %.2f degrees Fahrenheit.\n\n", cel, fer);
system("PAUSE");
return (0);
}
float celsius_at_depth (int d, float c)
{
c = (10 * d)+ 20;
}
float fahrenheit_at_depth (float c, float f)
{
f = (1.8 * c )+ 32;
}
the problem is the celsius and farenheit is not compile???
Both celsius_at_depth and fahrenheit_at_depth has return type float. That means that the functions are supposed to return a float. To return a value from a function you use the return keyword as you have done in the main function.
c and f inside the functions are just copies of cel and fer so any changes to c and f will not affect cel and fer.
If you use return instead of assignment inside the two functions you don't need the second parameter. Instead you can use assignment in main to give cel and fer the values returned from the functions.