Code:
#include <stdio.h>
int main(void)
{
int count_emp = 0;
int numb_days = 0;
double temp;
double total_temp;
int average_temp;
printf ("Please enter number of days (1-7):\n");
scanf ("%d" ,&numb_days);
while (count_emp < numb_days)
{
printf ("Please enter the temperature:\n");
scanf ("%lf" ,&temp);
total_temp = total_temp + temp;
count_emp = count_emp +1;
}
average_temp = total_temp / numb_days;
printf ("All temperatures have been entered\n");
printf ("Average temperature of %d\n" ,average_temp);
return(0);
}
I get a warning message:
warning #2229: Local 'total_temp' is potentially used without being initialized.
I run the program and seems to do what its suppose to. can someone please explain why i'm getting this warning?