How to pass a pointer struct to a function properly?

Hello, I have several functions in which I am trying to pass an element of array of pointers (which contains structures (records)). I'm having trouble doing this and I'm pretty stuck and frustrated. I'm very new to pointers and memory so go easy on me. I keep getting errors when I try to pass the specific structure element into the function.

What can I do to fix/change this and make it work? Thank you for the help, it is very much appreciated.


The error I get:
 
'changeAssignmentGradeForStudent' was not declared in this scope



CODE:

Structure student
1
2
3
4
5
6
7
8
9
10
11
typedef struct {

	char firstName[50];
	char lastName[50];
	char studentNumber[10];
	char NSID[10];
	float assignments[10];
	float midterm;
	float final;

}Student;



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
void useFunctions(int recordNum) {

	// array of 10 student references
	Student* students[recordNum];

	// values received from the user
	for (int i = 0; i < recordNum; i++) {

		cout << "Student " << i+1 << ": " << endl;
		students[i] = readStudentRecordFromConsole();
	}

cout << "Would you like to make any changes to any student records? (N or Y)" << endl;
	cin >> answer;

			if (answer == 'N') {


				return;

				} else {

					cout << "Which student?" << endl;
					cin >> student;


					students[student-1] = gradeChanges(*students[student-1], recordNum, student);



}



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Student * gradeChanges(Student* s, int recordNum, int student) {

	Student *changedStudent = s;
	int gradeChange, aNum;

	   cout << "assignment number to change?" << endl;
           cin >> aNum;
           cout << "assignment to change?" << endl;
           cin >> gradeChange;

	   changeAssignmentGradeForStudent(changedStudent, aNum, gradeChange); // where the errors are

	   return changedStudent;
	}
changeAssignmentGradeForStudent(changedStudent, aNum, gradeChange); // where the errors are

This is an attempt to call the function changeAssignmentGradeForStudent, which apparently doesn't exist.
Topic archived. No new replies allowed.