must know about the header files in c.

tanvisharma

tanvisharma

@tanvisharma-wSaer7 Oct 22, 2024
We all know that header files contain some predefined functions, yes thats exactly true.
but we have to know how the program is present in the header files....

header files are nothing but simple text files with ".h" extension, all the header files are present in the include directory, which we can find when we open the turboc.

the header files does not contain the whole code for the predefined functions, but it just contains the prototypes required for the function( i.e predefined functions).

and the actual code is present in the library not in text files but,
the actual code object file is present in the library.

so when we start the compilation process, the code is copied in the place of the header file....
and finally the program is executed.... 😀

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Uday Bidkar

    Uday Bidkar

    @uday-bidkar-X1y63x Jul 13, 2012

    Well, it's partially correct, compiler does not copy "code" in place of header file. Compiler copies exact contents of the .h file into the unit it's included in while compiling and generates object file for that particular compilation module. Linker then comes in picture which combines the different compiled modules and generates an executable. This is why you get a "Linker error" if you just declare a function and dont define it.