Hi, i'm new to C and i need a little help with a function i am writing to read in user input from the keyboard, a set of integers, and store them into an array. The input is terminated when the user types any invalid integer input. Integers are seperated by white space or new lines. Here is what I got so far... Do I use the ISDIGIT function as a condition for the loop? Also the (empty) array is created in the main program, and passed over to the function to add to it.
--------------------------------------------------------------------
#include <stdio.h>
void get_input(char input_array[]);
int main()
{
char input_array[999];
get_input(input_array);
return 0;
}
void get_input(char the_array[])
{
int i;
for (i=0; ???????????; i++) {
printf("Enter stream of integers: ");
scanf("%c", &the_array[i]);
}
}
--------------------------------------------------------------------
I hope there aren't TOO many mistakes in there If anyone can give me any advice in how to create the condition for the loop, it would be much appreciated!
Thankyou!