Author: Stephen G. Kochan
Publisher: Addison Wesley
Audience: Newcomers to C
Reviewer: Alex Armstrong
Learning to program in C - is this book a good approach?
C is the language that inspired C++, C#, objective C and many other languages, but the reason you might want to learn it isn't anything to do with history. C is a language that is closer to the machine's actual hardware and as such it is educational and useful. If you want to write a program that is fast and uses minimum memory then C is your best choice. If you want to do better than C you need to move to assembler and even then you probably won't do very much better.
As a result C is experiencing a new relevancy because of the Internet of Things (IoT) where is it ideally suited to making the best use of the limited hardware most IoT devices offer.
So what better than a 4th edition of a fairly thick book on C programming that starts from the basics?
The book starts off by explaining the ideas of compilation, linking and so on but without referring to any particular implementation. Chapter 2 gets you off the blocks with a first program - which is hello world in disguise as it prints "programming is fun". The example makes use of gcc to compile and link and there is very little help given if you want to use some other compiler or an IDE. You can more or less say that the book leaves it mostly up to you to workout and setup your C environment which makes things fairly easy for Linux users but not so easy for the beginner working with any other operating system.
The over all approach can be characterized by saying that it is very traditional. It tackles ideas in steady progression and if you programing in another language you might find it a bit too slow. Chapter 3 is about data types and arithmetic expressions and it does mention the _Complex and _Imaginary types right at the end, not sure why as they are more advanced than the current level.
Chapter 4 introduces flow of control with looping working up from a simple for loop to the more advanced ways you can make use of this flexible construct. The chapter deals with while and do and finishes on continue and break. Next comes the If and switch statement. The conditional operator is also introduced but arguably this could be left for a more advanced chapter.
Chapter 6 moves the subject on to arrays. This does relate the idea of an array to the way memory is used. It also introduces character arrays but not strings and not pointers.
Chapter 7 leaves the problem of data and moves on to bigger program structures - i.e. functions. The chapter is very broad and deals with how to define function and how to use them. Parameters and local variables are introduced but of course as we don't yet have pointers only input parameters are possible but we still manage to cope with array parameters and recursive functions.
After Chapter 7 we have more or less covered the core of the language. Now we have some mopping up of more advanced topics. Chapter 8 introduces structures, then chapter 9 strings and finally Chapter 10 introduces perhaps the most difficult topic in C - pointers. The big problem with the pointers chapter is that there is very little about dynamic memory management. Chapter 11 introduces bit manipulation and this is something that is often needed in C, but not so much in other languages because of the sorts of things you use them for.
The final few chapters get even further into the outlying topics of C - the preprocessor, enumerations, working with larger programs, file based I/O, and then a collection of "advanced" topics. The book comes to a close with a chapter on debugging and a short look at object oriented programming - objective C, C# and C++.
This is a book that the beginner will find it possible to follow but topics are introduced fairly fast and with a terse explanation. This is not a dumbed down book and you will have to put work in to understand the ideas. It also doesn't organize things into topics that reflect what you are trying to do. For example there is nothing integrating the different skills - bit manipulation, memory management, indirection etc, - into an approach to low level programming.
There is also nothing about the system dependent libraries that C programmers find themselves having to use all the time. You won't find any of the string libraries, timer libraries, date libraries and so on. Including them would have made the book very big, but you still need to find out about them. Finally, there is very little about C11, which the book jacket mentions as being included. If you have an earlier edition there is very little reason to buy the new 4th edition.
Overall this isn't a bad way to learn C and if you want a fairly complete and standard introduction then you might find this is what you are looking for.
21st Century C
C Primer Plus (6th Ed)
C Programming Absolute Beginner's Guide (3e)
Head First C
To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.