I have an assignment to take an average of x numbers entered by the user. The problem I have is that I don't know how to read an undetermined number of user inputted numbers into separate int variables. If I knew the amount of numbers the user was going to enter, then i'd use the following code to handle it...
How do I break up the user entered string into separate int variables without knowing how many numbers the user is going to enter?
printf("Enter 3 numbers: ");
fgets(line, sizeof (line), stdin);
sscanf(line, "%d %d %d", &number, &number, &number);