Mail Archives: djgpp/1998/03/04/20:19:18
At 11:02 3/4/1998 +0100, Reinier Heeres wrote:
>Hi!
>
>How can I define a structure that should look something like this:
>
>typedef struct {
> int a,b,c;
> test *children[4];
> } test;
For self-referential structures, you must use the struct tag. Like this:
typedef struct t {
int a, b, c;
struct t *children[4];
} test;
Now
struct t foo;
is the same as
test foo;
For additional obscurity, the `t' above can be changed to `test', so the
struct tag and the typedef name can be the same.
Btw, this would have been better posted to a comp.lang.c group.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -