From the course: Complete Guide to C Programming Foundations

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Understanding header files and libraries

Understanding header files and libraries - C Tutorial

From the course: Complete Guide to C Programming Foundations

Understanding header files and libraries

- [Instructor] It's common for beginning C programmers to confuse header files with C language libraries. These are two different things. Header files are used in the source code and libraries are used by the linker. Traditionally, the header files are found on a Unix system in the user include directory, and there they are. When you use the include pre-processor directive with angle brackets, this is the primary location from which the header files are fetched. The contents of these files are C language code. You see definitions, prototypes, and pre-processor directives listed. Library files are primarily located in the user lib directory. And there they are. When you create a C program, the linker looks in this directory for libraries to link in, such as the standard C library, which contains definitions for C functions such as printf. These are object code files exactly like those created by the compiler that contain binary data, not C language code. Other locations are used for…

Contents