B
Ben
Hello,
Is it possible to define a struct that has a type of itself in it?
So is it possible and if so how to do what I'm trying to do here?:
typedef struct mystruct {
int a;
mystruct *b;
} mystruct;
The above doesn't work:
test.c:7: undefined type, found `mystruct'
cpp-precomp: warning: errors during smart preprocessing, retrying in
basic mode
test.c: In function `main':
test.c:7: parse error before "mystruct"
test.c:7: warning: no semicolon at end of struct or union
test.c: At top level:
test.c:8: warning: data definition has no type or storage class
test.c:10: parse error before "return"
Thanks, Ben.
Is it possible to define a struct that has a type of itself in it?
So is it possible and if so how to do what I'm trying to do here?:
typedef struct mystruct {
int a;
mystruct *b;
} mystruct;
The above doesn't work:
test.c:7: undefined type, found `mystruct'
cpp-precomp: warning: errors during smart preprocessing, retrying in
basic mode
test.c: In function `main':
test.c:7: parse error before "mystruct"
test.c:7: warning: no semicolon at end of struct or union
test.c: At top level:
test.c:8: warning: data definition has no type or storage class
test.c:10: parse error before "return"
Thanks, Ben.