Thread: Structure

  1. #1
    Unregistered
    Guest

    Structure

    i have a question
    i have 2 files. One is the main one which calls another file both use same structure
    Do i have to declare it both files?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    It sounds like your after the extern keyword. Do a board search, 'cos I know there's been talk of this recently.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Hammer, can you explain your avatar???
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by Magos
    Hammer, can you explain your avatar???
    You don't recognise a HAL 9000 ??!!
    This will explain all
    The quote isn't quite right, I couldn't fit all the words in! The real one is:
    "I'm sorry Dave, I'm afraid I can't do that."
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Oh, hehe! No, i haven't seen that movie/read that book . Perhaps I should, is it any good?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    [OT]

    >movie
    The movie is quite old, and is somewhat slow. It's an acquired taste, imho. But I like it!

    >book
    This is better, it explains a lot more than the film ever could. Worth a read I think.

    Unregistered> Did you find the answer you wanted?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Do i have to declare it both files?
    Yes
    The best way is to put the structure in an include (.h) file, then include that in all the .c files which need it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem referencing structure elements by pointer
    By trillianjedi in forum C Programming
    Replies: 19
    Last Post: 06-13-2008, 05:46 PM
  2. Replies: 5
    Last Post: 02-14-2006, 09:04 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM
  5. C structure within structure problem, need help
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 11-30-2001, 05:48 PM