trying to make into list of students
thank you for your help.I have then proceeded to make it into a list of students.I get an error again.I dont know what wrongs
Code:
#include <stdio.h>
#include <stdlib.h> /* for malloc */
typedef struct student* studentPtr;
typedef struct{
char *firstName;
char *secondName;
}name;
typedef struct{
name *studentName;
studentPtr nextStudent;
}student;
int main(void){
name *a,*b;
student *c,*d;
a=(name*)malloc(sizeof(name));
b=(name*)malloc(sizeof(name));
c=(student*)malloc(sizeof(student));
d=(student*)malloc(sizeof(student));
a->firstName="david"; a->secondName="becks";
b->firstName="Eric"; b->secondName="Olmado";
c->studentName=a;
d->studentName=b;
c->nextStudent=d; /*warning line*/
return 0;
}
i get the warning of incompatible type.
tried hard to figure it out though.maybe my basic is wrong