Need help with returning variables from a function
hi guys, I need a little help with this program I'm writing. I need it to send the information in My_Temp to the main function. But the problem I'm having is it's in an array so I'm a little loss. Any help would be appreciated! Thank you!
Code:
#include <stdio.h>
#include <math.h>
double input ()
int main ()
{
double input ();
return 0; //End Program
}
double input () //Input Array
{
int My_Temp; //Declare Variables
double fahr[25];
printf("Please input the number of temperatures you would like to enter: "); //User Input
scanf("%i", &My_Temp);
if (My_Temp < 0 || My_Temp > 25) //Check User Input
{
printf("Invalid Entry");
scanf("%i", &My_Temp);
}
printf("Please enter %i temperatures", My_Temp); //User Input
scanf("%lf", fahr[My_Temp]);
if (fahr[My_Temp] > 175.0 || fahr[My_Temp] < -175.0) //Check User Input
{
printf("Invalid Entry");
scanf("%lf", fahr[My_Temp]);
}
return (fahr[My_Temp]); //Return Temperatures
}