Thread: Problem with typedef struct

  1. #1
    Registered User cprogrammer_18's Avatar
    Join Date
    Dec 2005
    Posts
    9

    Problem with typedef struct

    Hi All,
    I am facing problem with the Problem code. Can any one help?

    Code:
    #include <stdio.h>
    
    typedef struct
    {
    	void        *data;
    	AdQueueNode *next;	 
    }AdQueueNode;
    
    
    int main()
    {
    AdQueueNode q;
    
    ...
    ...
    ...
    
    }
    When I tried to compile the following error came.

    Code:
    test.c:7: parse error before "AdQueueNode"
    test.c:7: warning: no semicolon at end of struct or union
    test.c:9: warning: data definition has no type or storage class
    test.c: In function `main':
    test.c:14: `n' undeclared (first use in this function)
    test.c:14: (Each undeclared identifier is reported only once
    test.c:14: for each function it appears in.)
    Please help, What I am doing wrong?

    Thanks in Advance.

    Regards,
    Maddy.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    typedef struct
    {
    	void        *data;
    	AdQueueNode *next;	 /* <-- Here */
    }AdQueueNode;
    There is no such thing as 'AdQueueNode' at that point. You want something like this:
    Code:
    typedef struct foo
    {
        ...stuff...
        struct foo *next; /* <-- This. */
    } AdQueueNode;

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User cprogrammer_18's Avatar
    Join Date
    Dec 2005
    Posts
    9
    Thank you quzah


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 06-04-2009, 02:03 PM
  2. pointer problem or so...
    By TL62 in forum C Programming
    Replies: 19
    Last Post: 01-12-2008, 11:45 PM
  3. Looking for a way to store listbox data
    By Welder in forum C Programming
    Replies: 20
    Last Post: 11-01-2007, 11:48 PM
  4. Somthing wrong with my typedef struct.
    By Queatrix in forum C++ Programming
    Replies: 9
    Last Post: 09-13-2005, 09:49 PM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM