#include Include headers or other source text

#include Include headers or other source text

#include inserts a header or source text into the translation unit. Search order is implementation-defined; include guards prevent duplicate definitions.

CategoryPreprocessor directives
KindKeyword / Statement
C standardC89 / C90

📝 Syntax

#include <header-name>
#include "header-name"

▶ Example

Edit the C code below and click Run; the server compiles and executes it:

Output:

Standard header included
ℹ️ Info The exact search paths for angle brackets and quotes are implementation-defined. Typically, the quoted form first searches implementation-defined local locations and then proceeds as for the angle-bracket form; compiler options can add include directories.

📚 Related Tutorials

❓ FAQ

QWhat is the difference between angle brackets and quotes in #include?
A#include <name> is primarily used for implementation-provided headers, while #include "name" usually searches project-related locations first. The exact search order depends on the compiler and its include-path configuration.
QWhy does a header file need an include guard?
AWhen the same header is included repeatedly, an include guard made from #ifndef, #define, and #endif skips its subsequent contents, preventing duplicate definitions within one translation unit.
QHow should I troubleshoot a header that #include cannot find?
ACheck the file name, extension, and path capitalization, then verify that the header is installed and that you are using the appropriate angle-bracket or quoted form. Next, inspect the compiler's include directories, including whether the project header directory is in the search path. Do not bypass a missing header by copying its declarations.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

Content reviewed by MOTO · Found an error? Report it

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏