Quiz Entry - updated: 2026.07.14
What's the difference between #include <file> and #include "file"?
<file> searches the system include paths (use it for library headers); "file" searches the current/project directory first and then falls back to the system paths (use it for your own headers).
// Search system include paths
#include <stdio.h>
// Search current directory first, then system
#include "myheader.h"
Search order:
| Syntax | Search Path |
|---|---|
<file> |
System directories (/usr/include, etc.) |
"file" |
Current directory → then system directories |
When to use which:
// Standard library headers
#include <stdio.h>
// System/third-party headers
#include <stdlib.h>
// Your project's headers
#include "config.h"
// Local headers
#include "utils.h"
What #include actually does:
// Literally copies the file content here
#include "header.h"
// ↓ becomes ↓
/* contents of header.h pasted here */
Tip: Use include guards or #pragma once to prevent double-inclusion:
// header.h
#ifndef HEADER_H
#define HEADER_H
// ... contents ...
#endif