title: What is the difference between - 1) Preprocessor,linker, 2)Header file,library? Is my understanding correct?
body: <p>Okay, until this morning I was thoroughly confused between these terms. I guess I have got the difference, hopefully.</p>
  
  <p>Firstly, the confusion was that since the preprocessor already includes the header files into the code which contains the functions, what library functions does linker link to the object file produced by the assembler/compiler? Part of the confusion primarily arose due to my ignorance about the difference between a header file and a library.</p>
  
  <p>After a bit of googling, and stack-overflowing (is that the term? :p), I gathered that the header file mostly contains the function declarations whereas the actual implementation is in another binary file called the library (I am still not 100% sure about this).</p>
  
  <p>So, suppose in the following program:-</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
        printf("whatever");
        return 0;
  }
  </code></pre>
  
  <p>The preprocessor includes the contents of the header file in the code. The compiler/compiler+assembler does its work, and then finally linker combines this object file with another object file which actually has stored the way <code>printf()</code> works.</p>
  
  <p>Am I correct in my understanding? I may be way off...so could you please help me? </p>
  
  <p><strong>Edit:</strong> I have always wondered about the C++ STL. It always confused me as to what it exactly is, a collection of all those headers or what? Now after reading the responses, can I say that STL is an object file/something that resembles an object file?</p>
  
  <p>And also, I thought where I could read the function definitions of functions like <code>pow()</code>, <code>sqrt()</code> etc etc. I would open the header files and not find anything. So, is the function definition in the library in binary unreadable form?</p>