Modern C
Table of Contents
Jens Gustedt
(@JensGustedt@digitalcourage.social)
1. The C23 edition of Modern C
The free version of this new edition is now available at
This new edition has been the occasion to overhaul the presentation in many places, but its main purpose is the update to the new C standard, C23. The goal was to publish this new edition of Modern C at the same time as the new C standard goes through the procedure of ISO publication. The closest approximation of the contents of the new standard in a publically available document can be found here. New releases of major compilers already implement most of the new features that it brings.
Among the most noticeable changes and additions that we handle are
those for integers: there are new bit-precise types coined
_BitInt(N)
, new C library headers <stdckdint.h>
(for arithmetic
with overflow check) and <stdbit.h>
(for bit manipulation),
possibilities for 128 bit types on modern architectures, and
substantial improvements for enumeration types. Other new concepts in
C23 include a nullptr
constant and its underlying type, syntactic
annotation with attributes, more tools for type generic programming
such as type inference with auto
and typeof
, default
initialization with {}
, even for variable length arrays, and
constexpr
for name constants of any type. Furthermore, new material
has been added, discussing compound expressions and lambdas, so-called
“internationalization”, a comprehensive approach for program failure.
Also added has been an appendix and a temporary include header for an easy transition to C23 on existing platforms, that will allow you to start off with C23 right away.
2. Early access to the C23 edition of Modern C
3. Print version
4. Online resources
4.1. Downloads
The most recent version available is from Oct. 15, 2024.
- a CC licensed version of Modern C
- a MIT licensed version of the code examples
- is archived here
- may be downloaded as zip file.
4.2. Blog
I sometimes use my blog to dump new ideas where I think C should head to, and to keep an updated list of the features that might go into C2x.
5. Be a sponsor
I am not producing this book for a living, but the people at Manning do. If you still think that you don't want to buy a printed or e-paper version and are satisfied by using the public version, you're welcome to do so.
You could still think of contributing a little bit, either by volunteering to
- your favorite software project
- a software industry improvement project
- a free speech or publication project
- the national C standards committee of your country
or anything else that makes the whole world (or maybe just our planet) a better place.
You could also contribute by giving whatever money you may spare to such a project. There are many projects in need of contributions, not all important open source projects out there are financed by big money, and that independence is important.
6. Terms
6.1. Licence for this version of the book itself
6.2. Copyright and License of provided source code
The C source code provided with this book is licensed under the following standard MIT license: ---------------------------------------------------------------------- Copyright © 2015-2024 Jens Gustedt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------