Re: About header files



Richard Heathfield wrote:

Thus, I include the header files. main.c also uses stdlib.c
and stdio.h. Do I include them again or do I use inclusion guards to
check if they are already included (e.g. in functions.c)?

Include them as often as you like. They are already protected by inclusion guards.

And that is the case for all standard headers?

Do I HAVE to
declare the function prototype as extern in the header file?

No. For functions, it's the default, and it can be omitted. Indeed, it almost always /is/ omitted.

Interesting. Thank you.

Chris
.



Relevant Pages

  • Re: First things you check for when youve got errors
    ... if the header file is ... commonly copy-paste inclusion guards from one header file to another. ... I'd define a consistent convention for inclusion guard macro ... portable standard C, I'd feed it a list of file names (though it ...
    (comp.lang.c)
  • Re: First things you check for when youve got errors
    ... if the header file is ... I commonly copy-paste inclusion guards from one header file to ... I'd define a consistent convention for inclusion guard macro ... portable standard C, I'd feed it a list of file names (though it ...
    (comp.lang.c)