Structs in Linked Lists

Im having trouble creating a struct within a struct node. the program suppose to
hold students firstname, lastname, and gpa in a node therefore creating my linked list. Line 26 keeps saying that cannot convert parameter 2 from 'studentType to std::string
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
#include <iostream>
#include <string>

using namespace std;

struct studentType{
	string firstname;
	string lastname;
	double gpa;
};

struct nodeType{
	studentType info;
	nodeType *link;
};
void insertFirst(nodeType *& head, string item);

int main(){

	nodeType *nameshead = NULL;
	studentType student1;
	student1.firstname = "Mike";
	student1.lastname = "Freel";
	student1.gpa = 3.2;
	
	insertFirst(nameshead,student1 );


	system("pause");
	return 0;
};

void insertFirst(nodeType *& head, studentType student)
{
    // step 1. Make the "New node"
    nodeType *newNode = new nodeType;
	newNode->info = student; // set the "info" on the newNode to the "student" received via function paramter
    
    // step 2. Set the "Link" of "new node" to the current "head"
    newNode->link = head;
    
    // step 3. Update "head" to now point to this "new node"
    head = newNode;
}
Comare line 16 second parameter and line 33 second parameter. These are different functions.
Thanks Konstantin2. Maybe it was just getting really late last night where i couldnt see that lol
Topic archived. No new replies allowed.