how do i make a header file and use it in another program

+3 votes
asked Sep 2 by atulsangahvi (200 points)
Where my header.h file needs to be stored so that i can call it?

2 Answers

0 votes
answered Sep 5 by xDELLx (2,950 points)

For small programs, the best place is current directory ,ie same directory as the c file.

But this can be customised using compiler switches.Complier can be "informed" t olook for header files in certain paths where we want/have stored header files.Compiler switches give us the flexibilty to provide a host of paths , where the header files can be placed.

On GCC, -I (uppercase i) switch can be supplied when compiling your program.

gcc abc.c -I /home/mint

MS Visual Studio also provides the same flexiblity , you can explore this... I am rusty with MS tools.

0 votes
answered Sep 19 by akash singh yadav (180 points)
it stored in the library of programing file
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...