Thread: Diff between Header file and Module

  1. #1
    john212
    Guest

    Diff between Header file and Module

    What is the difference between a header file and a module?
    Are both always necessary?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    A header file contains declarations only. A module (if you refer to the separately compiled c file) contains the actual data.
    The header file tells the other parts of the program what is in the module since they don't know until the linking occurs.
    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.

  3. #3
    john212
    Guest
    so are both always necessary?

  4. #4
    Registered User Pioneer's Avatar
    Join Date
    Dec 2002
    Posts
    59
    Modules are the ones that do the work, header files are the ones that give you access to the modules, so you need both.

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    >> so are both always necessary?

    You use the word always so I'm going to assume you mean always. The answer is this, you only need a header when you use a function that is in the actual module. Even if you compile a library (or whatever form of module you are refering to) or something into your program!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Need help understanding Header Files
    By Kaidao in forum C++ Programming
    Replies: 11
    Last Post: 03-25-2008, 10:02 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. Function basics
    By sjleonard in forum C++ Programming
    Replies: 15
    Last Post: 11-21-2001, 12:02 PM