|
Computer Science & Software Engineering C Programming (CITS1210) - Lecture 5 |
|
||||||
File inclusion using the C preprocessorTo date, we've used the C-preprocessor to include a number of the standard header files that are part of ISO-C99, with the syntax:
What is really happening here? Each installation of a C compiler on an operating system will come with the 18 standard header files. On our Macs, Linux, and Unix systems, these header files are stored in the directory:
/usr/include/
and, thus, the file included is /usr/include/stdio.h
A search of the /usr/include/ directory (using the ls program), will reveal many non-standard header files there, too, and further operating system-specific subdirectories and their header files. Creating our own header filesIt's also possible to create our own, non-standard, header files (we'll see this in Lecture 7).We include our own header files with:
which does not prepend any special directory name.
Note: it's normally considered very bad practice to use the
C-preprocessor to include C source-code files (name.c).
| ||
|
C Programming (CITS1210), Lecture 5, p1, 28th August 2008. |