Thread: Struct definition problem

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    10

    Struct definition problem

    I defined following struct:

    Code:
    typedef struct COLABR {
      char     *className;
      COLABR   *next     ;
    } COLABR;
    It looks well but I get errors:
    error: syntax error befor COLBAR
    warning: no semicolon at end of struct or union;
    warning: type defaults to 'int' in declaration 'COLABR'
    warning: data definition has no type or storage class

    I can't see any problem but maybe I'm blind.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    The typedef for the struct hasn't been created while you're inside the struct. You need:
    Code:
    typedef struct COLABR
    {
      struct COLABR *next;
    } COLABR;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with struct
    By megazord in forum C Programming
    Replies: 3
    Last Post: 12-25-2009, 10:44 AM
  2. Help me please.
    By yann in forum C Programming
    Replies: 15
    Last Post: 09-29-2009, 09:04 PM
  3. pointer problem or so...
    By TL62 in forum C Programming
    Replies: 19
    Last Post: 01-12-2008, 11:45 PM
  4. Looking for a way to store listbox data
    By Welder in forum C Programming
    Replies: 20
    Last Post: 11-01-2007, 11:48 PM
  5. Replies: 10
    Last Post: 05-18-2006, 11:23 PM