Authors: Greg Perry & Dean Miller
Audience: Complete beginners
Reviewer: Mike James
C a language for the absolute beginner! Can a book that uses C take you on the journey to become a programmer?
The answer is a conditional "yes", and if you don't know what conditional means you probably need to read this book anyway.
The first thing to say is that this is a book for the absolute beginner, but that doesn't mean the same things as "clueless".
The C language is small and compact and this makes it a good choice for the beginner, but it is also very "close to the metal". What this means in non-techie terms is that C is a language that makes a lot of fuss about the way that data is stored - strings are null terminated, you have different sizes of integer variables and so on, not to mention a complicated set of low level operators etc. So while C is a compact language that makes it easy to learn, it is also an intricate low level language that makes it harder to learn.
What all this means is that this book is suitable for the complete beginner but only one that is wanting and willing to learn the very low level concepts of computing. You are going to have to put some work in no matter how easy the book attempts to make it.
Part 1 of the book is called Jumping Right In and it explains why you might want to code in Chapter 1 and gets started with a real program in Chapter 2. It makes use of the Code:Blocks IDE, which has the advantage of working on everything but the disadvantage of not being a mainstream IDE on any given platform. Overall this is a good choice. The text is full of boxes headed "Note" or "Warning" and you do have to be prepared to read some discontinuous information streams.
The first two programs that are presented look short and understandable. Chapter 3 goes some way to spoiling this. It introduces the idea of comments - which is a great idea. Beginners should learn the value of commenting code but not necessarily this early. At this stage the programs you are writing are trivial and really don't need comments. In this case it also has the side effect of making the examples seem so much more intimidating. They suddenly mushroom from five or six-line programs into things that take one or two pages. The comments don't make the code any harder to read, but they make it seem much more unapproachable. While comments are essential in the real world they don't really help a book aimed at beginners.
Chapter 4 deals with printf; Chapter 5 introduces variables; Chapter 6 is about string literals and character arrays; Chapter 7 is about header files and simple macro; Chapter 8 deals with input and scanf and Chapters 9 and 10 explain arithmetic and expressions. There is a lot of material to cover to reach this point, but a lot of it is the detail of how C works and not core concepts of programming. To this point the reader has been looking at default flow of control programs and one-after-another program execution. The idea of a variable and moving data around are the two key ideas to this point.
At Chapter 11 the book introduces the second key idea - the if statement and conditional execution. It does this very slowly, pointing out all of the things that beginners tend to get wrong. Chapter 12 moves on to logical operators and writing fairly complicated if conditions. Chapter 13 introduces more operators and admits that it is a bag of tricks - a lot of C is like this. Chapter 14 returns to core concepts with the introduction of the loop - the while loop - and chapter 15 introduces the for loop. Chapter 16 shows you how to break out of loops - something that some programmers think you shouldn't do. Next we get really sophisticated with the switch statement.
From here on in the book is increasingly focused on the lower level facilities that C provides. Chapter 18 describes character handling and 19 deals with strings. Chapter 20 is about advanced math - mostly functions. Chapters 21, 22 and 23 are about arrays and searching and sorting. Chapters 24 and 25 go into deep and dangerous territory by explaining pointers and their relationship to arrays. Chapters 26 and 27 explain the heap and structures.
The final part of the book is a collection of ideas. First we have two chapters on files and then three chapters on functions. Given how important functions are in C, and just about every language, it is strange to leave them right to the end of the book.
Overall it would be a much better book if the core concepts of flow of control and functions were introduced earlier and the difficult and C-specific topics of pointers and heap management were left until the end.
Even so this is quite a good basic introduction to C for the reader who knows nothing about programming. You have to be quite a bright and able know-nothing, however, as C doesn't spare you from a lot of detail that could be avoided in other "beginner" languages. I can well imagine some readers giving up simply because of the amount of detail that has to be understood to see the bigger picture.
If this is so, why start with C at all? The answer is that it does get you closer to the inner workings of the computer and it is a good stepping stone to C++ and more advanced languages. There are easier ways to get into programming than C but this book makes C about as easy as it can be, as long as you are prepared to do a lot of reading and a lot of thinking.
For the intelligent beginner this is a good way to learn C.