Pass a dynamically created struct to a function

How do u pass a dynamically created struct to a function by reference. I cant get this to work i keep getting error at the function call saying: " error: cannot convert 'Student**' to 'Student*' for argument '1' to 'void display(Student*) " ....... so can somebody take a look at this and help me fix it?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
struct Student
{
	string id;
	string name;
	double grades[MAX_GRADES];
	double average;
};

void display(Student *);    // function prototype

int main()
{
   Student *studentInfo = new Student[10];;
	
   display(&studentInfo);    // Call display function and pass structure to it by reference
	
   return 0;
}

void display(Student *studentInfo)
{
   cout << studentInfo[0].name;
}
Just call display( studentInfo )
The reason being studentInfo is already a pointer so you don't need to take the address of it again on line 15 with &.
oh thanks
Topic archived. No new replies allowed.