CrazyEngineers
  • must know about the header files in c.

    tanvisharma

    tanvisharma

    @tanvisharma-wSaer7
    Updated: Oct 22, 2024
    Views: 972
    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.... 😀
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Uday Bidkar

    MemberJul 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.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register