Modern C introduces you to modern day C programming, emphasizing the unique and new features of this powerful language. For new C coders, it starts with fundamentals like structure, grammar, compilation, and execution. From there, you’ll advance to control structures, data types, operators, and functions, as you gain a deeper understanding of what’s happening under the hood. In the final chapters, you’ll explore performance considerations, reentrancy, atomicity, threads, and type-generic programming. You’ll code as you go with concept-reinforcing exercises and skill-honing challenges along the way.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
# Modern C — Reading Guide
## 【One-Line Pitch】
A comprehensive, level-based journey through modern C programming that takes you from absolute basics to professional-grade topics like pointers, memory models, and concurrency — ideal for self-taught programmers, engineering students, and anyone who wants to write C the way it's meant to be written today.
## 【Book Arc】
- **Opening (~0%–10%)**: Introduces the book's four-level structure (Encounter, Acquaintance, Cognition, Experience) and starts with fundamental program structure, compilation, and execution — including why compiler warnings matter and how to interpret them.
- **Early (~10%–23%)**: Covers control structures (for, while, do, switch), boolean logic, and numerical algorithms, then moves into data types — including the dangers of mixing signed/unsigned values and the role of macros for constants.
- **Early (~23%–32%)**: Explores arrays, strings, and the standard library's string/memory functions (strlen, strcpy, memchr, etc.), plus structs — emphasizing that structs are passed by value and can be assigned but not compared with ==.
- **Middle (~39%–48%)**: Delves into library interfaces, error checking, file I/O with streams, and the optional Annex K bounds-checking interfaces — including a working implementation of a cat-like file reader.
- **Late (~48%+)**: Transitions into "Cognition" level — the heart of the book — covering pointers, C's memory model, dynamic memory allocation, and professional program organization and naming conventions.
## 【Key Takeaways】
- **Compiler warnings are your friends** (Early): Both gcc and clang produce detailed diagnostics that catch real bugs — like wrong main return types or missing headers. Pay attention to them rather than just checking if the program runs.
- **Zero means false, everything else is true** (Early): C treats any nonzero value as logically true in conditions. This lets you write `if (i)` instead of `if (i != 0)`, though which style you prefer is a matter of project convention.
- **Side effects in expressions are dangerous** (Early): Statements like `a = b = c += ++d` modify multiple objects at once and are nearly impossible to read correctly. The book's rule: never modify more than one object in a statement.
- **Mixed signedness comparisons can silently break** (Early): Comparing `-1` with `0U` gives false because the signed value converts to unsigned. These subtle bugs are hard to spot and can vary by platform — always be explicit about types.
- **Macros are textual replacement, not constants** (Early): `#define M_PI 3.14159...` simply substitutes text. While necessary for constants of certain types, macros should be visually distinct in naming conventions to avoid confusion with real variables.
- **String functions require 0-terminated strings** (Early): Using strlen, strcpy, or strcmp on a non-terminated array is undefined behavior — symptoms include slow scans, segmentation faults, or silent data corruption.
- **Structs are passed by value, not reference** (Early): When you pass a struct to a function, it's copied. To modify the original, you must reassign the return value — until pointers are introduced later in the book.
- **Annex K bounds-checking is optional and controversial** (Middle): The `_s` suffix functions (like printf_s) were designed for safety but many platforms reject them. The book marks these as optional and notes they've created more problems than they solved.
## 【Reading Tips】
- **Skim Level 0 if you have any C experience**: The opening "Encounter" level is a refresher for beginners. If you already know basic syntax, jump ahead to where control structures and data types get nuanced.
- **Deep-read the signedness and type conversion sections**: The tables showing mixed signedness comparisons (like `-1 < 0U`) are easy to skim but contain the kind of knowledge that separates competent C programmers from those who write subtle bugs.
- **Do the exercises, especially the numerical ones**: Implementing a numerical derivative and computing π decimals forces you to actually use the control structures and functions you've just learned — this is where the book's "learn to swim by jumping in" philosophy pays off.
- **Pay attention to the "Takeaway" boxes**: Each one distills a critical rule (like "Never modify more than one object in a statement"). These are the book's condensed wisdom — worth reviewing before writing any production code.
- **Expect to revisit the file I/O section**: The cat-like file reader example and stream mode tables are dense. If it doesn't click immediately, move on and come back — the later "Cognition" level will fill in gaps.
## 【Coverage Limits】
This guide covers the book's structure and early-to-middle content (through roughly 48% of the book). The later sections on pointers, memory models, dynamic allocation, performance, reentrancy, atomicity, threads, and type-generic programming are mentioned but not detailed here.
##
Excerpt 1
features such as control structures, data types, operators, and functions. It should give you a deeper understanding of the things that are going on when you...
e condition is verified; see table 4.1. They can be grouped Not all operations and their resulting values are observable from within your program. They are o...
t in s0 that consists of characters that also appear in s1. strcspn(s0, s1) returns the length of the initial segment in s0 that consists of characters that...
rce and execution environments may have different encodings. It is therefore crucial to have interfaces that work independently of the encoding. The most imp...
are an C assemblage of bytes . The sizeof operator that we introduced in the context of arrays measures the size of an object in terms of the bytes that it u...
he caller can detect this situation and call fgetline again to attempt to read the rest of the line or to detect an end-of-file [[Exs 1]] condition. [Exs 1]...
e loop and can, for example, be used in a printf statement. It looks as if they both are semantically equivalent, but they are not. For the first, the object...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Modern C (Jens Gustedt)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Modern C (Jens Gustedt)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment