[Solved] how is an header file implemented say an string.h file [closed]


Header files normally only contains prototype declarations of methods, just to satisfy initial compiler checks. The implementation files are already compiled to binary forms and distributed as library files. They are linked to your program during the linking process.

If you have studied C, you will remember that you used to add a prototype declaration of your custom method (which is defined below main() function) on top of the main() method. If not, you will get a compiler error. Header files contains these kinds of protocol declaration of methods that is defined in related cpp/c files, so that initial checks won’t stop the compilation. Writing this way also helps to hide the implementation part of your software, but other users can use this method for their needs by seeing the protocol declaration.

You can get more information about the compiling linking process here.

To answer your question

In c++, does string.h header file contain only the decleration of the
string functions?

Yes, they only contain declarations

If true, then where are they implemeted.

The related C++ files are compiled and distributed as library in binary format. On Unix systems it is in Standard C Library (libc)

2

solved how is an header file implemented say an string.h file [closed]