Thread: Data Structures

  1. #1
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187

    Data Structures

    Hey guys, I'm having a few problems with my data structures.

    I have a .h and a .c file. Thing is I got my data structures defined on my .h with some names in the structures such as node, etc ..
    When calling 'em on my .c file, they all appear as undeclared.

    Any idea why ?

    Thanks, Dean.

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    Did you include your header file? If you did post the relevant code, along with the complete error message, exactly as it appears in your development environment.

    Jim

  3. #3
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187
    Yeah I did.

    Error code :
    Code:
    aecfinal2.c: In function ‘alocanamemoriaapartirdotxt’:
    aecfinal2.c:21: error: expected expression before ‘Edge’


    And I declared edge on my .h like this :

    Code:
    typedef Edge *Grafo[MAX];


    The part of code in which I'm getting an error is this one :

    Code:
    Edge *novo;



  4. #4
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187
    No longer needed, fixed everything.
    Thanks anyway!

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    So, I assume you realised that your typedef was back-to-front?
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  6. #6
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187
    Yeah, I did, haha
    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-16-2005, 10:03 AM
  2. data structures
    By hawkins786 in forum C++ Programming
    Replies: 1
    Last Post: 05-12-2005, 03:42 PM
  3. Data Structures
    By vex_helix in forum C Programming
    Replies: 2
    Last Post: 04-25-2004, 02:47 PM
  4. Data Structures
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 05-08-2002, 11:12 AM
  5. Data Structures
    By sonicsite in forum C Programming
    Replies: 3
    Last Post: 02-28-2002, 09:56 PM