hi i have written a function outside of my main code and i was wondering how i could rewrite the function to return a value so that in my main code i can store the return value in a variable. this is the function code below
Code:
double getAltitude()
{
double a;
printf("\nEnter altitude (m):");
scanf("%lf", &a);
if (a > 9000)
{
printf("Invalid input! Altitude must be between 0 and 9000m");
return getAltitude();
}
else if ( a < 0 )
{
printf("Invalid input! Altitude must be between 0 and 9000m");
return getAltitude();
}
}
cheers