Advertisement

C programming makes my head spin....

Started by June 07, 2002 10:42 PM
1 comment, last by Tac-Tics 22 years, 3 months ago
OK, in vanilla C (no +''s included), how can you define a struct that contains pointers to an object of the same type you are defining? Example: In C++, this would work: struct foo; struct foo { int fooInt; foo* fooPointer; }; but it doesn''t in C. Can someone explain how you''d write that in C? Thnx in advnce. "You TK''ed my chicken!"
The problem is that "struct foo" is defined as soon as the definition begins, but "foo" isn''t.
struct foo {  int fooInt;  struct foo *fooPointer;};

The ''struct'' IS needed in C.

Advertisement
Ah! thnx u vry much

This topic is closed to new replies.

Advertisement