C - Should I use quotes or brackets to include headers in a separate directory
04:52 13 Jan 2021

I have a project with a src and an include directory. When compiling, I pass the include directory via the -I option (gcc -Iinclude ...).

Should I use double quotes (") or angle brackets (<) to include my own header files?


I tried to look for an answer and found these two conflicting statements:

  1. include header files relative to the c file via double quotes. Everything else (header files in include paths) with angle brackets. -> thus use angle brackets
  2. include standard headers with angle brackets. Everything else with double quotes. -> thus use double quotes

In my opinion statement 2 is clearer. When including a file with double quotes it is most obvious that it is my own header.


Should I use quotes or brackets to include my own header files? The C standard allows both possibilities. So what is the best practice?

c include c-preprocessor