Say I'm reading an input file, and I have a line which is just five integers separated by spaces like:
4 12 1
And if want to store these in an array I'd use something like
fscanf(fileName, "%d %d %d", &arr[0], &arr[1], &arr[2]);
(I'm new to C so please correct the above if that's not quite right)
However, this gets very clunky if I had even more integers on a line and wanted to store those in an array like
4 12 1 132 66 47 77 32
Is there a way to use a loop to read and store the first integer on the line, second integer, and so on?