Mail Archives: djgpp/1998/03/15/23:04:46
Michael Langton wrote:
> typedef int stype;
> struct nodeS {
>         stype   data;
>         nodeS   *next;
> }
> 
> I'm getting "parse error before 'nodeS'", but not all the time.  It
> sometimes works when I try it in a new program, and other
> circumstances which I'm not quite sure about.
> 
> Can anybody point out why this might be occurring?
The problem is that, in C, the tag of a structure is not legal without
being prefixed by the keyword `struct'.  That is:
    struct S { ... };
    S s; /* this is an error */
You have to reference it with the `struct' tag:
    struct S { ... };
    struct S s; /* this is fine */
-- 
         Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                       Alcyone Systems / http://www.alcyone.com/max/
  San Jose, California, United States / icbm:+37.20.07/-121.53.38
                                     \
        "I've got the fever for the / flavor of a cracker"
                                   / Ice Cube
- Raw text -