This question already has an answer here:
I would like an explanation of the difference between < header.h > and "header.h" in library #include
directives. How exactly (in which locations) does the linker search for the files? In what order does it perform the search?
When we write <stdio.h>
, we are referring to a header file which is available in the include directory of the system. When we write #include <stdio.h>
, the preprocessor searches for the header file in the system include directory and not in the current directory. When we write #include "stdio.h"
, the preprocessor starts searching for this header file in the current directory and then in its parent directories. So if we write our own stdio.h
, save it in the current directory, and include it in the program using #include "stdio.h"
then our header will be included instead of the system header.
In short, if we use angular brackets (<>
) then we are indicating that the file can be found in one if the standard directories in the
system. If we use quotation marks (" "
) then we are indicating that a non-standard header is being used.