I'm working on a little project in pure C. I use gcc compiler (and thats the idea). I have a struct as follows:
struct STACK{ char var; struct STACK* next; struct STACK* prev; }; and little lower in my function f():
STACK head; head->var='a'; printf("%c", head->var); Now, during compilation I get the error:
: In function ‘f’: :13:3: error: unknown type name ‘STACK’ :14:7: error: invalid type argument of ‘->’ (have ‘int’) :15:20: error: invalid type argument of ‘->’ (have ‘int’) Could someone explain me what is wrong ? When I was working in C++ and g++ everything seemed fine.
================= EDIT:
OK, that worked, but now I have to dynamically create structures of type STRUCT and only keep pionters to them. Is it possible in C ?