you did this:
Code:
typedef struct student* studentPtr;
before this:
Code:
typedef struct{
name *studentName;
studentPtr nextStudent;
}student;
the typedef doesn't know what struct student is, so it has problems.
you have to define the types that you use before you use them. this includes other syntaxes like when you use typedef.
normally, in C, you have to prepend a 'struct' keyword in front of struct things because that's the syntax. You can get around that with using the typedef, but there are some gotchas to that.
Code:
struct s
{
int a;
};
struct s my_s; /*legal*/
struct b{char my_char;};
b my_b;/*not legal*/
typedef struct b b;
b my_b;/*now legal*/
typedef struct {char my_char;}c;
struct c my_c;/*not legal*/
c my_c;/*legal*/
typedef struct d{char my_char;}d;
struct d my_d;/*legal*/
d my_d;/*legal*/
and just to throw you off:
Code:
struct e {
int my_int;
} my_instance;
my_instance i; /*not legal*/
int main()
{
struct e i; /*legal*/
i.my_int = 234; /*legal */
my_instance.my_int = 3254;/*legal*/
return 0;
}
maybe just put
Code:
typedef student* studentPtr;
after
Code:
typedef struct{
name *studentName;
studentPtr nextStudent;
}student;