Am I correct that you are trying to do the following:
1. The user enters numbers
2. You read in the numbers as strings and convert them to int
3. You calculate the sum of all ints
Perhaps you could try something like this:
The user enters numbers. If the user enters the word stop, then the loop ends. I've not tested this and probably there are better solutions, but you can give it a try.
stop = 0;
while (stop != 1)
if (strcmp (temp_array, "stop") == 0)
stop = 1;
total = atoi (temp_array);
sum = sum+total;
printf("the sum of these numbers is %d\n", sum);
The point where it is all about in my example is that you should introduce a check variable.