Parameter conversion?

See topic. For some reason, this code is giving me an error involving the second parameter of the function LoadStruct. The error is the following: 'LoadStruct' : cannot convert parameter 2 from 'studentType [35]' to 'studentType'. I'm relatively new to the language, so help on the topic would be appreciated, even more so if it's put in Layman's terms.

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iomanip>
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

struct studentType
{
	string firstName;
	string lastName;
	int midtermMark;
	int finalMark;
	int projectMark;
	float averageMark;
	char letterGrade;
};

int main()
{
	//Function Prototypes
	void GetInputFile(ifstream&);
	void LoadStruct(ifstream&, studentType, int);

	//Variables
	int counter;
	ifstream in_stream;
	//ofstream out_stream;
	counter = 0;
	
	studentType studentArray[35];

	GetInputFile(in_stream);
	LoadStruct(in_stream, studentArray, counter);
	return 0;
}

void GetInputFile(ifstream& in_stream)
{
	in_stream.open ("studentgrades.txt");
	if (in_stream.fail())
	{
		cout << "File not found." << endl;
		exit(1);
	}
	else
	{
		cout << "File Opened." << endl;
	}
	return;
}

void LoadStruct(ifstream& in_stream, studentType studentArray[], int counter)
{
	while ((!in_stream.eof())&&(counter <= 35))
	{
		in_stream >> studentArray[counter].firstName;
		in_stream >> studentArray[counter].lastName;
		in_stream >> studentArray[counter].midtermMark;
		in_stream >> studentArray[counter].finalMark;
		in_stream >> studentArray[counter].projectMark;
		counter++;
	}
	return;
}
it's because your prototype indicates that
 
void LoadStruct(ifstream&, studentType, int);


the 2nd argument only takes in studentType while the actual function definition is
 
void LoadStruct(ifstream& in_stream, studentType studentArray[], int counter);


You can fix it easily by changing your prototype to

 
void LoadStruct(ifstream&, studentType*, int);
Ok, that helped, thanks. Now the problem is that I have unresolved externals (whatever those are):

error LNK2019: unresolved external symbol "void __cdecl LoadStruct(class std::basic_ifstream<char,struct std::char_traits<char> > &,struct studentType *,int)" (?LoadStruct@@YAXAAV?$basic_ifstream@DU?$char_traits@D@std@@@std@@PAUstudentType@@H@Z) referenced in function _main
Topic archived. No new replies allowed.