The following is a snippet of code from a fuction I am making, but the "do while" for some reason gets stuck in an endless loop! What I want to do is read in values to the array "list" until a negative # is entered. I really need to get this fixed, if anybody can help.
THANKS!! Natwod
THANKS!! Natwod
Code:
double list[100];
double temp;
int listSize;
listSize = 0;
printf("Enter numbers, to stop enter -1");
scanf("%f", &temp);
do {
list[listSize] = temp;
listSize++;
printf("Enter next number: ");
scanf("%f", &temp);
} while (temp >= 0);