In C programming language, there are two ways to include header files in a program: using angle brackets (< >) or using quotes (" "). Here’s the difference between the two:
#include <header.h>
This syntax is used to include system header files that are part of the C standard library. The compiler searches for the header file in the system directories specified by the compiler, such as /usr/include on Unix-based systems or C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools
/MSVC/14.28.29910/include on Windows systems.
#include <stdio.h>
In this example, the stdio.h header file is included using the angle bracket syntax.
#include "header.h"
This syntax is used to include user-defined header files that are located in the current directory or in a directory specified by the user. The compiler searches for the header file in the current directory first, and then in the directories specified by the -I flag.
#include "myheader.h"
In this example, the myheader.h header file is included using the quotes syntax.
In summary, the main difference between #include <header.h> and #include "header.h" is in the way that the compiler searches for the header file. The angle bracket syntax is used for system header files that are part of the C standard library, while the quotes syntax is used for user-defined header files that are located in the current directory or in a directory specified by the user.