Arrays, tables and void functions... help...

Can anyone figure out how to read the next value from an input file and store it in array table while using a void function that is not letting you do it the
1
2
3
4
while (inData >> numbers[index])
			{
				index++;
			}

way because it says that file is not declared or exist due to the fact that it's in int main and that I have to use void.

Someone, please help.
Last edited on
void functions can take parameters.

void foo(ifstream &ifs) //this is a void function that has a file variable passed into it.

you probably want

void foo(ifstream &ifs, vector<int>& numbers)

Last edited on
Topic archived. No new replies allowed.