answersLogoWhite

0

Create the header file as a .h file in the same way you create a source file, .c and place it in the same directory as the .c files. To incorporate it, use the...

#include "my_header_file.h"

... directive. Note that there are double quotes instead of greater/less signs. This tells the compiler to look first in the source directory.

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
ReneRene
Change my mind. I dare you.
Chat with Rene
More answers

Create a new file with an (foo.)h extension. Now you have a header file that you can put stuff in, copy this new file into the folder where all your header file resides and #include "foo.h" in the c source files that need to reference the header file.

User Avatar

Wiki User

14y ago
User Avatar

> How do you create

With your favourite text editor/IDE.

> and use your own header files in C?

#include "my_own_header.h"

User Avatar

Wiki User

15y ago
User Avatar

Add your answer:

Earn +20 pts
Q: How can you create a headerfile in a c?
Write your answer...
Submit
Still have questions?
magnify glass
imp