Free C and C++ Books: Legally Free C Programming and C++ Books and References
A curated list of free C books and free C++ books you can read legally, plus the references and standards drafts professionals actually use. It covers beginner C, modern C (C23), modern C++ (C++20 and later), memory and pointers, systems and network programming, concurrency, performance, game and graphics programming, and compilers, with notes on what each book is best for and how it is licensed.
Last reviewed: December 2026. “Free” means free from an official source (author, university, publisher, standards body, or open license) at the time of review. No mirrors or pirated PDFs.
Table of Contents
- Quick Picks
- C vs C++: Which Should You Learn
- Reading Paths with Time Estimates
- Free C Books: Beginner
- Free C Books: Intermediate and Modern C
- Free C++ Books and Tutorials: Beginner
- Free C++ Books: Intermediate and Modern C++
- Guidelines and Style
- Systems, Operating Systems and Networking
- Performance, Memory and Concurrency
- Algorithms and Competitive Programming
- Games, Graphics and Interpreters
- References, Standards and Drafts
- Tools Every C and C++ Learner Should Use
- Excellent Paid Books (Clearly Marked)
- Old Links That No Longer Work
- Comparison Tables
- Practice Projects
- FAQ
- Where to Go Next
- Contributing
- License
Quick Picks
| You want… | Best free pick | Why |
|---|---|---|
| To learn C from zero | Beej’s Guide to C Programming | Friendly, modern, complete; pairs with a free library reference. |
| Modern, rigorous C | Modern C (C23 edition) | Written by a member of the C standards committee; free under CC BY-NC-ND. |
| To learn C++ from zero | LearnCpp.com | The most complete free C++ tutorial, continuously updated for modern C++. |
| C++ reference | cppreference.com | The reference everyone uses for C and C++ language and library. |
| How to write good modern C++ | C++ Core Guidelines | Maintained by leading C++ figures; rules with rationale. |
| Network programming | Beej’s Guide to Network Programming | The classic sockets tutorial. |
| Operating systems in C | Operating Systems: Three Easy Pieces | Free chapters; famous for clarity. |
| A project to learn C deeply | Build Your Own Lisp | Build a programming language in about 1000 lines of C. |
C vs C++: Which Should You Learn
| C | C++ | |
|---|---|---|
| Size of language | Small | Very large |
| Typical uses | Operating systems, embedded, drivers, language runtimes, libraries with C APIs | Games, browsers, finance, high-performance apps, engines, desktop software |
| Memory | Manual (malloc/free) |
RAII, smart pointers, containers (manual still possible) |
| Abstraction | Functions and structs | Classes, templates, lambdas, ranges, concepts, coroutines, modules |
| Current standard (at review) | C23 | C++23 (C++26 in finalization) |
| Best first free resource | Beej’s Guide to C | LearnCpp.com |
Advice: learn C if you target embedded or systems work, or want to understand how computers work. Learn C++ if you target games, performance-critical applications or large codebases. You do not need to learn C before C++; modern C++ is taught best on its own terms.
Reading Paths with Time Estimates
About one hour a day, five days a week, exercises included.
Path A: Learn C (8 to 12 weeks)
| Weeks | Read | Do |
|---|---|---|
| 1-4 | Beej’s Guide to C | Type every example; compile with -Wall -Wextra -fsanitize=address,undefined. |
| 5-6 | The C Book chapters on pointers and arrays | Write your own strlen, strcpy, dynamic array. |
| 7-10 | Build Your Own Lisp | Finish the interpreter. |
| 11-12 | Modern C, Levels 1-2 | Rewrite one earlier program using its guidance. |
Path B: Learn modern C++ (12 to 20 weeks)
| Weeks | Read | Do |
|---|---|---|
| 1-8 | LearnCpp.com chapters 0-12 | Quizzes at the end of each chapter. |
| 9-14 | LearnCpp.com chapters on classes, templates, move semantics, smart pointers | Build a small inventory or text-adventure program. |
| 15-17 | hackingcpp cheat sheets and Modern C++ Programming course | Fill gaps; look at the “advanced” slides. |
| 18-20 | C++ Core Guidelines (philosophy, resource management, interfaces) | Review your own code against them. |
Path C: Systems programmer (4 to 6 months, after Path A)
OSTEP for OS concepts, Beej’s Network Programming and IPC guide for Unix APIs, What Every Programmer Should Know About Memory for hardware, then the Linux Kernel Module Programming Guide.
Free C Books: Beginner
| Book | Author(s) | Best for | License / access |
|---|---|---|---|
| Beej’s Guide to C Programming | Brian “Beej Jorgensen” Hall | The best free modern C tutorial; conversational and thorough (covers newer standards). | Free online, PDF |
| Beej’s Guide to the C Library | Brian “Beej Jorgensen” Hall | Companion reference with examples for every standard library function. | Free online, PDF |
| The C Book | Mike Banahan, Declan Brady, Mark Doran | Clear explanation of ANSI C; especially good on pointers and declarations. Old (C89), but the core holds. | Free online (published free by GBdirect) |
| C Programming (Wikibook) | Wikibooks contributors | Broad community book; uneven depth. | CC BY-SA |
| Learn X in Y minutes: C | Community | One-page syntax tour for programmers. | CC BY-SA 3.0 |
| learn-c.org | Community | Interactive basics in the browser. | Free |
| CS50x | Harvard | Not a book, but the first weeks teach C extremely well, with free problem sets. | Free |
Best pick: Beej’s Guide to C. Keep the C Library guide open beside it.
Free C Books: Intermediate and Modern C
| Book | Author(s) | Best for | License / access |
|---|---|---|---|
| Modern C, C23 edition | Jens Gustedt | Rigorous modern C organized in levels from encounter to ambition; free version on HAL, print by Manning (paid). | CC BY-NC-ND 4.0 (code MIT) |
| Build Your Own Lisp | Daniel Holden | Learn C by building a Lisp with a parser combinator library. | Free online (CC BY-NC-SA) |
| Object-Oriented Programming with ANSI-C | Axel-Tobias Schreiner | How to build classes, inheritance and dynamic dispatch in plain C. Old but fascinating. | Free PDF from author’s site |
| Notes on Data Structures and Programming Techniques | James Aspnes (Yale) | Long C course notes: C, data structures, algorithms, tooling. | Free online |
| Build Your Own Text Editor | Based on the kilo editor by antirez | Step-by-step 1000-line terminal text editor in C. | Free online |
| The GNU C Language Intro and Reference Manual | Richard Stallman, Trevis Rothwell and others | A modern GNU manual for C, with GNU extensions. | GNU FDL |
| comp.lang.c FAQ | Steve Summit | Answers to classic confusing C questions (arrays vs pointers, declarations). | Free online |
| cdecl | Community | Translates C declarations like int (*(*f)(void))[3] into English. |
Free tool |
Free C++ Books and Tutorials: Beginner
| Resource | Author(s) | Best for | License / access |
|---|---|---|---|
| LearnCpp.com | Alex and contributors | Systematic, very complete, modern C++ tutorial with quizzes; updated regularly. | Free online |
| hacking C++ | André Müller | Visual cheat sheets and beginner-friendly articles on modern C++. | Free online |
| Learn X in Y minutes: C++ | Community | Quick syntax tour. | CC BY-SA 3.0 |
| StudyPlan.dev | StudyPlan | Structured C++ courses from zero, including game development tracks. | Free online |
| isocpp.org Get Started | Standard C++ Foundation | Official pointers to compilers, books and tutorials. | Free |
| C++ Super-FAQ | Standard C++ Foundation | Hundreds of answers on C++ design and usage. | Free |
Best pick: LearnCpp.com, cover to cover. It is effectively a free book.
Free C++ Books: Intermediate and Modern C++
| Resource | Author(s) | Best for | License / access |
|---|---|---|---|
| Modern C++ Programming course | Federico Busato | Over 20 lecture PDFs from basics to C++23 features, templates, performance and tooling. | Free (GitHub) |
| C++ Annotations | Frank B. Brokken | A long, regularly updated book for C programmers moving to C++, now covering recent standards. | Free online (GPL) |
| Programming in C++ lecture slides | Michael D. Adams | About 2,900 slides (2021 edition, current with C++20) with a companion exercise book and videos. | CC BY-NC-ND 3.0 |
| Modern C++ features cheat sheets | Anthony Calandra | What each standard (C++11 to C++20) added, with examples. | MIT |
| Abseil C++ Tips of the Week | Google Abseil team | Short essays on API design, strings, std::optional, value semantics. |
Free |
| C++ Stories | Bartłomiej Filipek | In-depth articles on modern features. | Free online |
| Arthur O’Dwyer’s blog | Arthur O’Dwyer | Deep, careful posts on value categories, move semantics, the standard library. | Free |
| Open Data Structures (C++ edition) | Pat Morin | Data structures implemented and analyzed in C++. | CC BY |
Guidelines and Style
- C++ Core Guidelines - edited by Bjarne Stroustrup and Herb Sutter; with the Guidelines Support Library.
- Google C++ Style Guide - opinionated rules for a large codebase; read the reasoning, not just the rules.
- C++ Best Practices - collaborative guide on tooling, warnings, safety and performance.
Systems, Operating Systems and Networking
| Book | Author(s) | Best for | Access |
|---|---|---|---|
| Operating Systems: Three Easy Pieces | Remzi and Andrea Arpaci-Dusseau | Virtualization, concurrency, persistence; C code throughout. | Free chapters online |
| Beej’s Guide to Network Programming | Brian “Beej Jorgensen” Hall | Sockets API in C: TCP, UDP, poll, IPv6. |
Free online, PDF |
| Beej’s Guide to Unix IPC | Brian “Beej Jorgensen” Hall | Pipes, signals, shared memory, message queues. | Free |
| The Linux Kernel Module Programming Guide | Peter Jay Salzman and others, maintained by sysprog21 | Writing kernel modules for current Linux. | OSL 3.0 |
| Computer Science from the Bottom Up | Ian Wienand | How computers, operating systems, linking and ELF actually work. | CC BY-SA |
| Linkers and Loaders (draft chapters) | John R. Levine | Free author-hosted manuscript chapters of the classic on linking. | Free online |
Performance, Memory and Concurrency
| Resource | Author(s) | Best for | Access |
|---|---|---|---|
| What Every Programmer Should Know About Memory | Ulrich Drepper | Caches, NUMA, memory performance; long but foundational. | Free PDF |
| Software optimization resources | Agner Fog | Optimizing C++, assembly, microarchitecture and instruction tables. | Free PDFs |
| Is Parallel Programming Hard, And, If So, What Can You Do About It? | Paul E. McKenney | Concurrency from locks to RCU, by the RCU maintainer. | CC BY-SA 3.0 |
| Compiler Explorer | Matt Godbolt and contributors | See the assembly your code compiles to. | Free tool |
Algorithms and Competitive Programming
| Book | Author(s) | Best for | Access |
|---|---|---|---|
| Competitive Programmer’s Handbook | Antti Laaksonen | Algorithms for contests in C++, with the CSES problem set. | Free PDF |
| Algorithms for Competitive Programming | Community (translation of e-maxx) | Huge collection of algorithm articles with C++ implementations. | CC BY-SA 4.0 |
| Open Data Structures (C++) | Pat Morin | Rigorous data structures in C++. | CC BY |
Games, Graphics and Interpreters
| Book | Author(s) | Best for | Access |
|---|---|---|---|
| Game Programming Patterns | Robert Nystrom | Patterns for game code (game loop, components, event queue) with C++ examples. | Free online |
| Crafting Interpreters, part III | Robert Nystrom | Build a bytecode virtual machine in C; one of the best C projects available. | Free online |
| Ray Tracing in One Weekend series | Peter Shirley, Trevor David Black, Steve Hollasch | Build a ray tracer in C++ over a weekend. | CC0 |
| LearnOpenGL | Joey de Vries | Modern OpenGL and rendering in C++. | Free online (CC BY-NC 4.0) |
| chibicc | Rui Ueyama | A small C compiler built in readable, incremental commits. | MIT |
References, Standards and Drafts
The ISO standards themselves are sold, but the final public working drafts are free and almost identical.
| Document | Notes |
|---|---|
| cppreference.com: C and C++ | The practical reference; includes compiler support tables. |
| C++ draft (eel.is) | Browsable current working draft of the C++ standard. |
| N4950 | C++23 working draft (PDF). |
| N3220 | Working draft just after C23 (PDF). |
| N1570 | C11 final draft (PDF). |
| WG21 and WG14 | The C++ and C committees’ pages and papers. |
| GCC online docs | Compiler flags, extensions, warnings. |
Tools Every C and C++ Learner Should Use
- Warnings: compile with
-Wall -Wextra -Wpedanticfrom day one. - Sanitizers: AddressSanitizer and UndefinedBehaviorSanitizer catch most beginner memory bugs instantly.
- Debugger: GDB manual; also Beej’s Guide to GDB.
- Memory checker: Valgrind manual.
- Build system: CMake tutorial and Modern CMake.
- Insight: C++ Insights shows what the compiler generates for range-for, lambdas and more; Compiler Explorer shows assembly.
Excellent Paid Books (Clearly Marked)
| Book | Why recommended | Status |
|---|---|---|
| The C Programming Language, 2nd ed. (Kernighan and Ritchie) | The classic; short and precise (C89). | Paid |
| C Programming: A Modern Approach, 2nd ed. (K. N. King) | Widely praised C textbook. | Paid |
| Effective C, 2nd ed. (Robert C. Seacord) | Professional, security-aware modern C. | Paid |
| A Tour of C++, 3rd ed. (Bjarne Stroustrup) | Compact overview of C++20. | Paid |
| Programming: Principles and Practice Using C++, 3rd ed. (Bjarne Stroustrup) | Beginner textbook from C++’s creator. | Paid |
| Effective Modern C++ (Scott Meyers) | C++11/14 best practices; still relevant. | Paid |
Old Links That No Longer Work
- Stanford CS Education Library (Essential C, Pointers and Memory, Linked List Basics) - at review time the
cslibrary.stanford.edudocuments returned 404. We removed them; please tell us if they return at an official address. - Thinking in C++ - we could not confirm a current official free host, so it is not listed.
- Avoid sites offering “free PDFs” of K&R or Stroustrup’s books; those are pirated.
Comparison Tables
First C resource
| Beej’s Guide to C | The C Book | Modern C | CS50x | |
|---|---|---|---|---|
| Level | Beginner | Beginner-intermediate | Intermediate-advanced | Absolute beginner |
| Standard | Modern (C11 onward) | C89 | C23 | Modern |
| Style | Friendly tutorial | Classic textbook | Rigorous, rule-based | Video course |
| Exercises | Few | Some | Many challenges | Problem sets |
First C++ resource
| LearnCpp.com | hacking C++ | Modern C++ Programming slides | C++ Annotations | |
|---|---|---|---|---|
| Level | Beginner to intermediate | Beginner to intermediate | Intermediate to advanced | Intermediate (from C) |
| Format | Tutorial chapters with quizzes | Cheat sheets and articles | Lecture PDFs | Long book |
| Updated | Continuously | Regularly | Regularly | Regularly |
Practice Projects
C, beginner: a calculator reading expressions; cat, wc and grep clones; a dynamic array and linked list library with tests.
C, intermediate: a text editor (kilo tutorial); a Lisp (Build Your Own Lisp); a small HTTP server with sockets; a memory allocator.
C++, beginner: a bank system with classes; a text adventure; a matrix class with operator overloading.
C++, intermediate/advanced: a ray tracer (Ray Tracing in One Weekend); a thread pool; a small game with SDL or raylib; a JSON parser using std::variant; a bytecode VM following Crafting Interpreters.
FAQ
What is the best free C book? For beginners, Beej’s Guide to C Programming. For a rigorous modern treatment, Modern C (C23 edition), which its author publishes free under CC BY-NC-ND.
What is the best free C++ book? LearnCpp.com is the most complete free option. After it, read the C++ Core Guidelines and the Modern C++ Programming course slides.
Is K&R (The C Programming Language) free? No. It is a paid book. Free PDFs online are pirated.
Should I learn C before C++? Not necessary. If your goal is C++, start with modern C++ directly; habits from C (raw arrays, manual memory) are discouraged in modern C++.
Which C++ standard should I learn?
Learn with C++20 or later enabled (-std=c++20 or newer). Most tutorials teach C++17/20 features; check compiler support on cppreference.
Are the C and C++ standards free? The official ISO documents are paid, but the public working drafts linked above are free and close to final.
How long does it take to learn C++? Core language and standard library basics take 3-6 months part time; real proficiency in templates, performance and large codebases takes years.
Where to Go Next
- free-programming-books-go-rust - Rust is the most common “next” systems language.
- free-programming-books-python, free-programming-books-java, free-programming-books-javascript
- Bigger lists: free-programming-books, awesome-cpp, awesome-c
- Talks: CppCon on YouTube
Contributing
Open an issue or pull request with the official URL (no mirrors), the license or access terms, edition and standard covered (C99, C23, C++20…), and one sentence on who it is best for. Dead links and books that stop being free are removed.
License
This list is released under CC BY 4.0. The books belong to their authors and publishers under their own terms.
If this helped you, a star helps others find it.
More free resources
Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.