Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet or computer – no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
21st Century C Paperback – 11 Nov. 2014
Purchase options and add-ons
Throw out your old ideas about C and get to know a programming language that's substantially outgrown its origins. With this revised edition of 21st Century C, you'll discover up-to-date techniques missing from other C tutorials, whether you're new to the language or just getting reacquainted.
C isn't just the foundation of modern programming languages; it is a modern language, ideal for writing efficient, state-of-the-art applications. Get past idioms that made sense on mainframes and learn the tools you need to work with this evolved and aggressively simple language. No matter what programming language you currently favor, you'll quickly see that 21st century C rocks.
- Set up a C programming environment with shell facilities, makefiles, text editors, debuggers, and memory checkers
- Use Autotools, C's de facto cross-platform package manager
- Learn about the problematic C concepts too useful to discard
- Solve C's string-building problems with C-standard functions
- Use modern syntactic features for functions that take structured inputs
- Build high-level, object-based libraries and programs
- Perform advanced math, talk to internet servers, and run databases with existing C libraries
This edition also includes new material on concurrent threads, virtual tables, C99 numeric types, and other features.
- Print length406 pages
- LanguageEnglish
- PublisherO'Reilly Media
- Publication date11 Nov. 2014
- Dimensions18.3 x 2.23 x 23.4 cm
- ISBN-109781491903896
- ISBN-13978-1491903896
Safety and product resources
Issue loading the information
- Product safety imagesManufacturer informationResponsible person
Issue loading the information
Issue loading the information
Issue loading the information
Product description
About the Author
Ben Klemens has been doing statistical analysis and computationally-intensive modeling of populations ever since getting his PhD in Social Sciences from Caltech. He is of the opinion that writing code should be fun, and has had a grand time writing analyses and models (mostly in C) for the Brookings Institution, the World Bank, National Institute of Mental Health, et al. As a Nonresident Fellow at Brookings and with the Free Software Foundation, he has done work on ensuring that creative authors retain the right to use the software they write. He currently works for the United States FederalGovernment.
Product details
- ASIN : 1491903899
- Publisher : O'Reilly Media; 2nd ed. edition (11 Nov. 2014)
- Language : English
- Paperback : 406 pages
- ISBN-10 : 9781491903896
- ISBN-13 : 978-1491903896
- Dimensions : 18.3 x 2.23 x 23.4 cm
- Best Sellers Rank: 1,032,229 in Books (See Top 100 in Books)
- 163 in C
- 350 in Design Pattern Programming
- 453,655 in Foreign Language Books
- Customer reviews:
About the author

Discover more of the author’s books, see similar authors, read book recommendations and more.
Customer reviews
Customer Reviews, including Product Star Ratings, help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyses reviews to verify trustworthiness.
Learn more how customers reviews work on Amazon-
Top reviews
Top reviews from Germany
There was a problem filtering reviews right now. Please try again later.
im Stil (informell, leger, entspannt) von Scott Meyers C++ Serie findet man Gründe warum man C nicht mit dem uralten Stil von K&R benutzen muss.
Es hat nur 250 Seiten Inhalt, kann keine Referzen-Bibel sein. Und im preface (auf amazon.com) und am Inhaltsverzeichnis erfährt man ob das für einen geeignet ist.
Der Auto ist Statisiker (2015: US treasury for ~tax revenue prediction ) und hat viele R Funktionen nach C ausgelagert bis er auf R ganz verzichtet hat (preface page x). Sein anderes Buch Beschäftigt sich mehr damit "Modeling with Data: Tools and Techniques for Scientific Computing by Ben Klemens".
fyi bei youtube die ersten 4min ansehen: "Professor Brian Kernighan presents on 'How to succeed in language design without really trying".
Bin da auch seiner Meinung =)
Gut, dass mich einige Kapitel (die erste Hälfte) nicht interessieren ist mein Problem. Allerdings fehlt in der Vorstellung der Werkzeuge Lint. Würde der Autor das kennen, könnte er dem Leser einge obskure "Tips" sparen.
Was der Autor an case statement auszusetzen hat, wird der Rest der Welt nicht verstehen. Ausser Teilnehmer am International Obfuscated C Code Contest (...).
Oder die Bemerkung, dass es ja nicht so schlimm ist, Speicher nach einem malloc nicht mehr frei zu geben. Ist ja genug RAM da. Die Einstellung demonstriert er auch in einem Beispiel, bei dem in einer Fehlerbehandlung den voreilig allokierten Speicher nicht freigibt.
Um meine Nerven zu schonen, hab ich es vorgezogen nicht weiter zu lesen.
Dass er Autor herablassend über andere Bücher spricht (z.B. "No more bugs") belegt meiner Meinung nach nur, dass ihm **einige** Einblicke fehlen.
Übrigens: Ich programmiere seit 1976
Dieses Buch war ein absoluter Fehlgriff. Der Autor ist ein exzentrischer Schwätzer. Laut Homepage "A Computional Social Scientist". Was immer das ist. Kernighan&Ritchie und andere Bücher tut er mit den Worten "Those textbooks are still valid and still have value, but modern C code just doesn't look like in those textbooks". Meinen Respekt hat der Autor bereits in der Einleitung verspielt: "I don't care to compare the code in this book to the original C specification in K&R book. My telephone has 512 MB, so why are our C textbooks still spending pages upon pages covering techniques to shave KB of our executables? I am writing this on a bottom-of-the-line red netbook that can accommodate 3,200,000,000 instructions per second; what do I care about whether an operation requires comparing 8 bits or 16?"
Abgesehen davon, dass K&R sehr wohl die Wichtigkeit von klaren Kode betonen: Performance ist heute genauso wichtig wie vor 40 Jahren. Es sind ja auch die Anforderungen mitgewachsen. Mein Simulator soll aus gutem Grund so effektiv wie möglich sein (sonst hätte ich ihn in Go oder C# geschrieben).
Im ersten Teil des Buches geht es gar nicht um C. Der Autor erklärt uns zurückgebliebenen Deppen, dass wir Git verwenden sollen. Keine Ahnung was das mit dem Thema zu tun hat.
Im zweiten Teil geht es angeblich um C. Aber nie in einem strukturierten Art und Weise. Es gibt kaum Kode. Der Autor schwafelt lieber über Punk-Rock. Ich habe den Eindruck, er hat sich einfach zu viel zugedröhnt.
Eine nützliche Information fand ich im Buch dennoch: Die Referenz auf das altmodische "C in a Nutshell" Buch. Uncool, kein Punk, kein Funk. Aber dafür gründlich und kompetent gemacht.
Die guten Bewertungen zu diesem Buch sind mir ein absolutes Rätsel.
Top reviews from other countries
The low rating is due to recieving the book in a very poor state. It came with the cover dirty, damaged and a lot of bent pages.
I would return it, but I don't want to waste a good book.
I wanted a book to support learning modern C, as most of the other books are either dated or lightweight (I am no dummy; I am an IT - non coding - professional). One of the early pains for me is knowing the most effective way to set up the environment. This book certainly helps with that.
My motivation for learning C is primary to code embedded systems. A side-benefit is that C can be used almost anywhere to underpin other high level languages. C provides the necessary middleware between the operating system/hardware and these high level languages. For instance, I use F#. When I want to accesses the hardware on a Raspberry Pi, say using Wiring Pi, I have to interface with C bindings.
Audience: intermediate to advanced C programmers. The book does have a beginner C Tutorial in the Appendix.
[GRIPE] Personally I did not care for the overly informal tone and punk rock quotes. Explanations tend to be long and colourful. This book is the inverse of formal and terse[/GRIPE] Whatever dude, Right? lol. I would also say that the coding style varies, wildly and the Kindle version is nasty; Also: Ben should know better than to make sport of anyone's religion or deity.
Other than that, this book is quite possibly the most important book every written about C since K&R(ANSI), with the interesting twist that they are in fact quite different in scope and goal. K&R is really an English version of the ANSI standard with tutorial and example material for learning the structure of the language. K&R assumes you know the CS already and teaches the language grammar with classic CS examples.
21st Century C assumes you know the C Grammar and CS already and teaches how to build solutions with the C language using the improvements of TWO! updates to the C Language standard since K&R(ANSI(C89)).
This is C11 - GNU gcc supports everything that anyone is taking seriously - Right Now! Things like functions with default parameters and variadic macros for variable length functions replacing the infamous va_args system.
Chapters 1 through 5 walk you through setting up a development environment on a UNIX/BSD/Linux type system using standard tools and libraries that provide you with more functionality than the much touted "high level" languages and all of their functionality. He does this step by step in a very practical manner from beginning to end so that you are set-up to work through the rest of the book.
Of course, he could have used combinations of several different libraries and built many completely different development environments specialized for all kinds of different problem domains (C as an ad-hoc DSL)
With C you could choose a different set of tools with better performance, domain optimization, or other advantages -- and still be using the same language OR you could mix and match. Remember, the language is tiny, when you change libraries they make all the difference... C is powerful for the very reason that is small and simple. Ben really drives this point home and gives examples of C vs. R (a statistics DSL) with the C code being both easy to understand and much faster. Faster matters MORE now than ever because the fundamental principles of Turing machines are fixed in cold hard reality but our data sets continue to increase in size and complexity. Faster Code Matters.
Chapter 6 goes into depth about pointers for those that struggle with fundamental operations on Z and indirection. It also mentions other storage types and how to avoid using dynamic memory at all in many cases.
Chapter 7 & 8 cover the mechanical issues of language syntax both good and bad.
Chapter 9 covers string handling, it starts with asprintf() and meanders through string stuff. In all fairness, what Ben is trying to do would fill an entire book on its own. My advice: use the sds library by Salvatore Sanfilippo (antirez(redis)) on github
Chapter 10 is about structs, this is the best part of the book for me, goes in depth on many improvements and extensions. Includes an example of a foreach function on a compound literal. Worth the price of the book...
Chapter 11 Goes into depth about using OOP methodology in C. Though C is not an OOP language the ancient K&R C was good enough to create cfront, so OOP in C has always been a reality, what C lacks is the "syntactic-sugar" of C++. Again, the neat thing about C (and C++) is that you can pick and choose features without being forced into a pradigm by someone else.
Chapter 12 is parallel programming and covers both threading (pthreads) and processing (OpenMP) and adds in C11 atoms covering the stdatomic.h and threads.h in the standard library
Chapter 13 Libraries for programming with the C language. This section gives examples with Glib, GSL (GNU Scientific (math) Library), SQLite (The single file include SQL DB), libxml and cURL.
goto github /b-k/21st-Century-Examples for a forkable repo of all of this book's numerous examples.
You should also check out: /dale48/levawc for a large library of ADTs in C,
and /antirez/sds for the Simple Dynamic Strings library.
Highlights: It does a great job demonstrating implementing OOP concepts in C. A solid chapter on concurrency. Tips for needing to malloc/free memory less, and a better approach when needed. The Better Structures and Object-Oriented Programming in C were the stand-out chapters in the book.
When the book was written, MSVC wasn't supporting C11. That has changed recently, which means the concepts in this book work whether you're using a POSIX toolchain or Microsoft Visual Studio.
If you don't already know C, I don't think this is the first book you read. Get The C Programming Language from K&R, spend a couple weeks learning the most basic concepts, then move on to this book to learn how to actually use and build software with C which K&R won't teach you.