One prob i have is how you make your own header in C?
One prob i have is how you make your own header in C?
Last edited by fastprogrammer; 11-14-2005 at 10:59 AM.
Type text into a file. Generally the file is saved with an .h extension.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
I see if that works.
As an aside, you would #include it like this:
#include "my_header"
You mean:
(C headers end in .h by convention)Code:#include "my_header.h"
Originally Posted by cwr
Absolutely that is what I meant. Thanks for the correction.
That make sence now.
You would also want inclusion guards:
This prevents bad things from happening if you include the header twice or in two different files.Code:#ifndef HEADER_H #define HEADER_H 1 /* header file code here */ #endif
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
dwks,
What is the point in adding advice to a 6 week old thread, especially given that the original poster hasn't posted anything since the last reply to this thread before yours?
See the guidelines (number 5).