[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: see below



Posted for Gary Desrochers:

>typedef union Acombination *mycombo;
>struct Anotherblock{
>       int someint;
>       char somechar;
>       struct Ablock * someblock;
>       };
>struct Ablock{
>       int someint;
>       char somechar;
>       };
>union Acombination{
>      struct Ablock ablock;
>      struct Anotherblock anotherblock;
>      };

  There appears to be two things wrong with the above declarations, based
upon my understanding of C syntax:

  (1) You should declare Ablock before it is referenced in Anotherblock.

  (2) Likewise, the typedef declaration should appear *after* the
      declaration of Acombination.

  There is no reason why you should have forward declarations in this code,
and to my knowledge they are illegal in any case.

  Hope that helps.

-- 
| Philip Stephens, Systems Programmer. | %%%%  %     Labtam Australia Pty Ltd |
| Address:  43 Malcolm Road, Braeside, |   % % % %     "Applied Ingenuity"    |
|           Victoria, 3195, AUSTRALIA. |  %  % %  %  We make the fastest RISC |
| Internet: philip@labtam.labtam.oz.au | %%%%% %%%%% X terminals in the world |