Thread: Tree of Struct with Linked List

  1. #1
    Registered User
    Join Date
    May 2007
    Location
    Australia
    Posts
    3

    Tree of Struct with Linked List

    I'm trying to get a structure called "employee_struct"
    where family_members are a linked list. but i cant even get the structure to work. i keep getting conflicting types of employee_struct. what is wrong with it?!
    ------------------------------------------
    Code:
    typedef struct employee_struct;
    
    typedef struct {
         char name;   
         int age;
         int height;
         int weight;
         LIST* family_members;
    }employee_struct;
    
    
    -------------------------------
    
    struct node{
         employee_struct data;
         node_t *left;
         node_t *right;
    }
      
    ------------------------------------

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Get rid of the first typedef, since it's not actually doing anything, and you're not actually using it.


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

  3. #3
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    yeah, no sense in declaring it twice =P

    That compiled?
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Junior89 View Post
    yeah, no sense in declaring it twice =P

    That compiled?
    No, it didn't compile. That's what the "redeclaration error" does. :D


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

  5. #5
    Registered User
    Join Date
    May 2007
    Location
    Australia
    Posts
    3

    Smile

    thank you for your help
    it fully doesnt have that error now!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with linked list sorting function
    By Jaggid1x in forum C Programming
    Replies: 6
    Last Post: 06-02-2009, 02:14 AM
  2. Replies: 6
    Last Post: 03-02-2005, 02:45 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM