Recommended Books on C and C++
Contents
Warning! Any book with sample programs which begin with "void main()" or "void main(void)" is absolutely, positively not recommended by me or most other knowledgeable C and C++ programmers. This non-standard illegal definition is used by many as a litmus test. If an author does this, he/she either doesn't know or can't be bothered with learning, using, and writing about the actual languages defined by their respective International Standards. It is very likely that the author will make other subtle and not-so-subtle errors in the book.
In the past twenty-five years computers have come to pervade our society. Without elaborating on that, it does mean that the demand for computer programmers has grown almost exponentially over the past two decades. And that means a vast increase in the number of individuals studying computer programming in school, and attempting to learn on their own.
This in turn has led to a large market for books on all aspects of computers and programming, including C and C++ programming.
Unfortunately, this mass market for books on C and C++ has caused many totally unqualified authors to write books on the languages.
Many authors of books on C and C++ have never bothered to learn the actual standard for the languages. They might be familiar with a particular compiler, including all of its implementation-defined behavior, extensions, and perhaps a few compiler bugs, and not know the difference between the actual language and anything at all that their compiler will compile and execute.
In fact some of the sample code in the books of at least some authors was never tested, because it won't compile with any compiler at all!
Note that I am only talking about books which claim to represent standard C or C++, or just use the name of the language with no qualifications which amounts to the same thing. There is nothing wrong with a book which claims to teach some specific Borland C++ version, or Windows programming using some Microsoft specific class library, and which details these non-standard extensions. Even then, the book should make clear what is part of the language, and what belongs to extensions provided by the particular compiler.
There are many books available today on "advanced" topics in C and C++, like data structures, algorithms, and programming methodologies. I am sure that many of these are excellent, but they are rarely relevant in the particular types of programming so I am not familiar with them.
I will only make recommendations for books which support the standard C and C++ languages here, and deal with the basic languages themselves rather than algorithms, methodologies, or the like.
If you read the usenet C and C++ programming newsgroups or read their Frequently Asked Questions list (FAQ) you will discover quite a few different books recommended by experienced programmers, including some whose judgment I trust implicitly. But I have not included all of their recommendations on this list. The only books on this page are those which I own and have read myself, and in my judgment alone are worth recommending.
The absence of any book from this list does not mean that I think there is something wrong with it. It probably only means I do not own it and have not read it.
There are not a lot of recommended books here.
When I first learned C there was no language standard, and most
of the introductory books I used to learn from are obsolete today.
Many of them were good books, but equally good books are available
today which do conform to the real standard. But since the standard
I haven't needed introductory books.
Likewise I first learned C++ from the first edition of The
C++ Programming Language by Bjarne Stroustrup. But I won't
recommend that book today, as the C++ language finally standardized
in 1998 underwent a lot of changes before the standard was adopted.
I only have a few books which are up to date with the final standard
which I can recommend.
Tutorial Book On C
- The C Programming Language, Second Edition
Brian W. Kernighan & Dennis M. Ritchie
Prentice Hall 1988
Hardcover ISBN 0131103709
Softcover ISBN 0131103628
Dennis Ritchie was the primary developer of C. This is the second
generation of the book which started the C revolution in computer
programming. It is well written and an excellent tutorial for
learning the language. Its accuracy to the original ANSI/ISO/IEC
1990 standard is nearly perfect.
This book, sometimes referred to as K&R2 to distinguish
it from the original version often just called K&R
is written in what I consider to be the best format for a tutorial,
with a light style and a natural progression from simple to more
complex topics.
K&R2 is a usable book for a beginner to use in learning
C as a first programming language, but a reader who has had some
programming experience in any language will get the most out of
it. It is certainly a book no serious C programmer should be
without. It is also an excellent reference book, but not as good
as the two listed in the reference book category below.
- C Programming: A Modern Approach
K. N. King
W. W. Norton & Company 1996
Softcover ISBN 0393969452
King's modern approach makes extensive use of what he calls his
spiral technique. He doesn't stop and explain every detail and
feature of C immediately. In some cases he only describes a feature
sufficiently to meet the needs of the example at hand, then comes
back to cover it in more detail later in the book. When he introduces
a new topic this way, he puts a pointer in the margin indicating
the section covering the topic in more detail, for those who might
want to know more about it immediately.
This book is the best beginner's tutorial I have seen and it quite
thorough in its coverage of the basic and intermediate features
of the ANSI/ISO International Standard C language.
There are the usual exercises at the end of each chapter, organized
and labeled to indicate which specific section of the chapter
covered the material. There is also a Q&A section at the end
of each chapter, based on typical questions King receives from
students in his C programming class at Georgia State University.
The appendices to the book include the C language grammar, an
operator precedence chart, a useful one comparing "K&R"
to ANSI/ISO C, and one appendix containing a brief description
of every standard library function in alphabetical order. This
one in particular will make the book useful as a programming reference
even after the reader has grown beyond needing it as a tutorial.
C Reference Books
While K&R2 belongs on every C programmer's bookshelf,
professional programmers need solid reference books at hand. Anyone
who does a significant amount of programming in C, professionally
or not, should have one or more of the following reference books.
- C A Reference Manual, Fourth Edition
Samuel P. Harbison & Guy L. Steele Jr.
Prentice Hall 1995
Softcover ISBN 0133262243
Harbison and Steele have done an excellent job with this series,
and the fourth edition incorporates the latest 1995 changes to
standard ANSI/ISO C. It is not tutorial at all, but an excellent
reference book.
- Standard C A Reference
P. J. Plauger & Jim Brodie
Prentice Hall 1995
Softcover ISBN 0134364112
As a reference book this is nearly on a par with Harbison and
Steele, above, but it offers one tremendous additional benefit.
The book includes a floppy disk containing all of the essential
information of the book itself on a set of completely cross indexed
HTML files. This allows you to call up an online fully searchable
reference to the language and library in your favorite web browser
at any time.
- C Programming FAQs
Steve Summit
Addison Wesley 1996
Softcover ISBN 0201845199
Steve Summit is the maintainer of the Frequently Asked
Question (FAQ) list for the C language discussion
newsgroup comp.lang.c. Many newsgroups
have FAQs because newcomers to the group ask many of the same
questions over and over again, and the regulars get tired of answering
them over and over again.
The C Programming FAQ contains answers to dozens of the most common
questions asked by new programmers learning the language. That
means it has solutions to dozens of the most common problems new
C programmers encounter.
The FAQ is available on line in several formats and can
be found here.
The book version contains more questions and answers than any
of the on line versions. This is a good book for any C programmer,
novice or experienced pro alike, and one that should be reread
every once in a while.
Intermediate and Advanced Books On C
- C Unleashed
Richard Heathfield, Lawrence Kirby, et al.
Sams Publishing 2000
ISBN 0672318962
Disclaimer: I am one of the contributing authors of this book. I wrote Chapter 18, "Digital Signal Processing". I do not receive any royalties or other financial benefit from the actual sales of the book, other than perhaps the opportunity to become involved in more book projects in the future.
By weight alone, this book delivers excellent value for the price! Seriously, the book contains articles by some extremely experienced C programmers tackling some of the most complex areas of programming in C. For those who are regular or occasional readers of the newsgroups comp.lang.c and comp.lang.c.moderated, about half of the authors will be very familiar as they are regular contributors to these groups.
The source code for all of the articles is included on the companion CD, and most of it written so that if necessary you can copy and paste it into your own code for immediate use. On the other hand, you can use the code and text to explore and understand the various specialized applications of C for yourself.
No matter how experienced a C programmer is, it is unlikely that he or she has written code in every type of application where C is used. I've been using C for nearly 20 years, but I've never used a sparse matrix or tries, just two of the advanced topics covered in the book.
I seriously doubt whether any C programmer can fail to find details on some algorithms or techniques that he or she has never used in their own programs before, but might very well need tomorrow.
Even if you don't like my chapter, the rest of the book is worth it!
All of the code in my chapter (but not the text, which belongs to the publisher) is covered under the GPL (Gnu Public License), and I have posted it here on my site. See my C Unleashed page for details.
I have not read other titles in the Sams "Unleashed" series, but I am going to take a closer look at them in the future.
- The Standard C Library
P. J. Plauger
Prentice Hall 1992
Softcover ISBN 0131315099
You don't need to know how the standard library functions do their
jobs to use them properly, but sometimes it can be very helpful,
especially when porting code from one platform to another. Mr.
Plauger himself has been heavily involved in both C and C++ standardization.
His company, Dinkumware Ltd.
produces implementations of the standard C and C++ libraries which
are purchased by some of the largest compiler vendors to include
with their compilers.
The implementation in the book uses Unix for its operating system
interface, and does not cover the later additions to the C library
of the functions for wide characters and character strings.
Tutorial Books On C++
- Accelerated C++
Andrew Koenig & Barbara E. Moo
Addison-Wesley 2000
Softcover ISBN 020170353X
Most books on C++ recapitulate the evolution of the language. First they start with C for the first chapter or few chapters, perhaps with cin and cout replacing scanf() and printf().
Accelerated C++ breakes this mold completely. This book rapidly introduces the reader to the C++ language as it exists today, defined by its very own ANSI/ISO International Standard. The text and code samples begin by introducing the std::string type and work their way through vectors, algorithms, iterators and all the modern methods including those in what used to be known as the Standard Template Library, now just one part of the C++ language and library. It is not until Chapter 10, "Managing memory and low-level data structures" that pointers, arrays, and C style strings are mentioned, the latter because they are still used for processing command line agruments and opening files.
This book also debunks one of the cliches used by some in the C++ programming community: "Learn C++ and you will know C as well." Not if you learn C++ properly! The reader who works with this book and builds the sample programs will come away with an excellent grasp of C++. He/she will not learn every element of the many containers and classes provided, but will understand the concepts behind them all and be well prepared to explore and learn the others. But that same reader will not learn enough to write "Hello World" in C.
There are only two drawbacks to this book that I can see.
The first is that it is not suitable for absolute beginners with no programming experience at all, at least just for reading. The authors state that this book was developed for teaching classes in the language, and with interactive help from a teacher or assistant to answer questions it might well be possible to use it in a beginner's class. But there is just too much material presented too quickly for an inexperienced reader to handle, in my opinion.
On the other hand anyone with some experience in programming in C or another language should have an easier time grasping the concepts and should do well with this book.
And for someone like me, whose main C++ experience dates back to much earlier days of the language, when C++ was little more than "C with classes", this book is ideal for getting up to speed with the real C++ language.
The other drawback I alluded to is that there is no companion disk or CD containing the code samples from the book. This may well be intentional, under the assumption that the reader has to pay more attention to the code when typing it in by hand, but is certainly unusual these days.
Still anyone wanting to learn the true potential of C++, whether an almost-beginner or even experienced C++ users, must get this book.
- Teach Yourself C++, Fifth Edition
Al Stevens
MIS:Press 1997
Softcover ISBN 1558285520
Al Stevens has been, among other things, the C and C++ columnist
for the magazine Dr. Dobb's Journal. Like other books in
this category, this one has gone through multiple revisions as
the language evolved. The first four editions this book were aimed
at C programmers who wanted to make the transition to C++. The
fifth edition is written to be a complete tutorial for someone
learning C++ with no C or any other programming experience.
All source code in the book is also on the included CD, as is
an added bonus for Windows 95 users. The CD includes a complete
simple implementation of gnu-win32 C and C++ compilers with a
limited IDE. The version of gnu-win32 he used does not completely
support all features of the 1998 C++ International Standard, but
neither does any other compiler available at this time. Stevens
clearly specifies in the book which parts of standard C++ his
compiler doesn't handle.
Stevens specifically mentions that his compiler, named Quincy97,
runs under Windows 95 (and indeed it does, I have installed and
used it) but doesn't mention Windows NT. That leads me to believe
that it might not run under NT. Since the book and compiler were
released long before Windows 98 I have no idea whether it will
run under this version.
If running the compiler under Windows 98 or Windows NT is important
to you, I suggest you check with MIS:Press before purchasing the
book.
- Teach Yourself C++ In 21 Days, Second Edition
Jesse Liberty
Sams Publishing 1997
Softcover ISBN 0672310708
I bought this book because I wanted the compiler package which
Sams had bundled on a CD with it. However I am incapable of having
a book on C or C++ in my possession without skimming through it,
and reading the interesting parts in detail. Liberty's approach
is thorough and he carefully lays the groundwork for each step.
He makes every effort to keep to the C++ language standard, and
does a good job of succeeding. All of the source code for the
book is available online from the publisher, and from the web
site of Liberty Associates, the author's company.
Liberty supports the purchasers of his books after the sale. He
provides errata and FAQ lists for each of his books. He even provides
documentation on the use of compilers which publishers sometimes
bundle with his books, without his knowledge or approval, sometimes
without adequate documentation or installation utilities.
This kind of support of readers and users of the book after the
purchase is welcome and refreshing.
Advanced Book On C++
- The C++ Programming Language, Third Edition
Bjarne Stroustrup
Addison-Wesley 1997
Softcover ISBN 0201889544
Dr. Stroustrup is the creator of the C++ programming language,
and has been continuously active in its development and standardization.
This third edition of his book describing C++ is fully up to date
with the new International Standard. It thoroughly covers the
features and use of C++.
I list the book as advanced, rather than tutorial, because in
my opinion it is not truly suitable for a beginner to use in trying
to learn the language on their own. While the text and examples
do proceed step-by-step from the simple to the complex, it is
extremely dense with concepts and information. Rather than the
breezy style of what I consider to be the better tutorials this
book reads like a college text.
This would be an excellent book for one familiar with C, or earlier
versions of C++, looking to get up to speed on all the features
of the new standard C++, and it makes an excellent reference book.
No serious C++ programmer should be without it, but I do not recommend
it to beginners learning their first programming language.
The Association of C and C++ Users ACCU has reviews of over 1900 books on C, C++ and Java.
This page validated by
W3C HTML Validation Service
©2000 By Jack Klein. All Rights Reserved.
All trademarks are acknowledged to belong to their respective
owners.
Updated 29-Oct-2000