Building an array from a text file with a function

I am very new to C++ programming. I'm attempting to construct an array by inputting values from a text file and walking through it with a count. The text file is random size but no larger than 500 integers. I picked [3] in my array just to confirm that the file was being correctly read and input into my array. I thought that this code would compile, but I received an error message I am unfamiliar with:

"E:\collect2.exe [Error] ld returned 1 exit status"

How would I go about correcting this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

#include <iostream> 
#include <iomanip>
#include <string>
#include <math.h>
#include <fstream>

using namespace std;

int const SIZE = 500;
void inputScores(int scores[SIZE, int);


int main()
{
	int scores[SIZE];
	int count =0;
	ifstream inputFile;
	
	inputScores(scores[SIZE], count);
	cout << "The value is: " << scores[3];
	system("pause");
	return 0;
}

void inputScores(int scores[SIZE], int count)
{
	ifstream inputFile;
	
	inputFile.open("array_pgmdata.txt");
	if (!inputFile) cout << "Error Something wrong with file" << endl;
	for(count = 0; count < SIZE && inputFile >> scores[count]; count++)
	{ 
		inputFile >> scores[count];
	}
	inputFile.close();
}

Thats not how you send arrays into functions. Watch this -

https://www.youtube.com/watch?v=VnZbghMhfOY
Check line 11. Also line 34 is not correct. You can't do that.
Topic archived. No new replies allowed.