The C standard library is a toolbox of headers shipped with every C compiler—<stdio.h> for printing, <string.h> for text, <stdlib.h> for memory, and more. This page is your central hub: understand how #include works, browse all 19 header tutorials, and try examples that combine the most common libraries.
01
#include
Pull in headers.
02
stdio.h
printf, files.
03
string.h
Text in C.
04
stdlib.h
malloc, exit.
05
Header Index
19 tutorials.
06
-lm
math.h link tip.
Fundamentals
Definition and Usage
A header file (.h) declares functions, types, and macros. The library implementation (linked automatically on most systems) provides the machine code. You write #include <stdio.h> so the compiler knows printf exists; the linker attaches the real printf from the C runtime.
The C standard defines many headers. This site documents 19 of the most-used ones—each with its own tutorial (syntax, five examples, FAQs). Start here for the big picture, then dive into individual headers from the index below.
💡
Beginner Tip
Include only what you need in each .c file. If a file uses printf and strlen, include both <stdio.h> and <string.h>. Do not rely on one header to include another unless the standard guarantees it.
Foundation
📝 Syntax
Include standard headers with angle brackets at the top of your source file:
Five small programs that combine the most common standard library headers. Compile with gcc file.c -std=c11 -o out.
📚 Getting Started
Output and string basics from the reference example, improved.
Example 1 — Hello with stdio.h
The smallest useful program uses printf from <stdio.h>.
C
#include <stdio.h>
int main(void) {
printf("Hello from the C standard library!\n");
printf("stdio.h provides printf, scanf, and file I/O.\n");
return 0;
}
📤 Output:
Hello from the C standard library!
stdio.h provides printf, scanf, and file I/O.
How It Works
printf writes formatted text to stdout. \n starts a new line. return 0; tells the operating system the program succeeded.
Example 2 — String Compare and Concatenate
From the reference: strcmp and strcat with stdio + string.
errno from errno.h after failed system/library calls; use perror from stdio.h.
C99+ features (stdbool.h, stdint.h) need -std=c99 or later.
POSIX adds extra headers (not covered here)—stick to standard C for portability.
Pro Tips
🚀 Usage Tips
Include headers explicitly — do not rely on transitive includes.
Read each tutorial — every header page has five examples and FAQs.
Handle errors — check return values; use errno and perror.
Link math — gcc ... -lm when using math.h.
Learn the sidebar order — tutorials chain from assert.h to wctype.h.
Wrap Up
Conclusion
The C standard library is the foundation of practical C programming. Use this hub to pick the right header, then open the dedicated tutorial for deep coverage. Start with stdio.h and string.h, add stdlib.h for memory, and grow from there.
Browse the index above or follow the sidebar from assert.h through wctype.h.
Ignore compiler warnings about implicit declarations
Mix wide and narrow I/O without conversion
Use gets (removed from C11)
Forget -lm when linking math functions
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about the C library
Your map to every standard header on this site.
5
Core concepts
💬01
Headers
Declarations.
#include
📝02
stdio
I/O first.
Start
🔗03
string
Text ops.
Core
🛠04
stdlib
Heap mem.
malloc
📚05
19 guides
Full index.
Hub
❓ Frequently Asked Questions
The C standard library is a set of headers (stdio.h, stdlib.h, string.h, and others) that declare functions, types, and macros for I/O, memory, strings, math, time, and more. You #include the headers you need; the linker connects your program to the library implementation.
Use angle brackets: #include <stdio.h>. Angle brackets tell the compiler to search system include paths. Quotes (#include "my.h") are for your own project headers. One .c file includes only the headers it directly uses.
Start with stdio.h (printf, scanf), string.h (strlen, strcmp), and stdlib.h (malloc, exit). Add ctype.h for character tests, math.h for calculations, and errno.h when file or system calls fail. This hub links to full tutorials for all 19 headers.
Usually no for stdio, stdlib, and string. On GCC and Clang, math.h functions often require -lm at the end: gcc program.c -std=c11 -o program -lm. Windows MSVC typically links math automatically.
The .h header declares names (prototypes, macros, types). The compiled library provides the actual machine code for those functions. Including stdio.h lets the compiler check printf; the linker pulls in printf's implementation.
Read the overview, browse the header index below, and try the five examples that combine stdio, string, and stdlib. Then open assert.h or stdio.h tutorials in the order shown in the sidebar.
Did you know?
Every C standard header is included with #include <name.h>. The compiler finds declarations; you link the C library automatically on most systems—except math.h often needs -lm on GCC/Clang.