SLIDE 14 14
Header files
- #include <stdio.h> does make the preprocessor dig out a text file
called 'stdio.h', and put all its contents where the directive was. You could find stdio.h yourself, and do this with copy/paste.
- The '<>' means “look for it in the default path for system things” -
writing #include “myfile.h” instead would make the preprocessor look around the directory where the rest of your code lives.
- stdio.h doesn't actually contain any code for printf – it just has a
function definition without a body, something like int printf ( const char *fmt, … ); which tells the compiler that yes, there is a function like this, its first parameter is a constant string, and the linker should be trusted with finding the actual object code.
- Thus, printf can be compiled once and for all, while
- nly its interface is run 10.000 times through the
compiler (and you don't need the source for printf itself).