Author: R. Chopra
A self teaching guide to C is always a good idea.
As I've said in other reviews, the day of C is far from over and, yes, it is still worth learning. This is partly because it is the language of systems programming and small microcontrollers, but also because it gives you a view of the internal workings of the machine like no other language - with, of course, the exception of assembler.
This is a fairly slim book for the topic it aims to cover. It starts off with a brief look at the history of C and the different types of C you might encounter. Even though it isn't the most up-to-date version of C, the book deals with ANSI C, which is something that might put you off, but there is still a lot of ANSI C around.
This chapter also goes into the details of how a program is compiled, linked and loaded and then leads up to a hello world program. It uses gcc (GNU Compiler Collection) but isn't specific about how to set this up, where to get it from or how to use an IDE. It is supposed that you will use an editor of your choice and the command line. Towards the end of the chapter some IDEs are mentioned. Strangely Kylix is one of them and as far as I know this hasn't been available commercially for many years and the Open Edition is hard to find. It also mentions Turbo C and MSDOS - which are historically interesting but not serious contenders for your attention. It does recommend CodeBlock, which is a reasonable choice. This reference to older technologies runs though the book with Pascal and Fortran being mentioned as examples of how things are done.
The presentation is good with lots of "do this" and "don't do this" comments, but the overall look of the page is spoiled by too much bold text. A worse problem is that the English used is slightly strange. I don't normally comment on this sort of thing, but in this case it increases the difficulty in understanding and there are places where it is simply mystifying.
The second chapter starts off with a lot of detail on the preprocessor. Getting to grips with C is hard enough and the preprocessor can be left until later. The description also isn't particularly helpful or accurate. For example, the directive:
is described as defining a variable. Well, more to the point it defines something that behaves more like a constant. Understanding this, and the fact that it is actually defines a symbol, PI, that you can use in your program that the preprocessor replaces with the text 3.14159, before compilation, is really important if you are going to avoid the subtle errors that are possible. Later on the idea of const is introduced and the fact that this is different from define is discussed, but only with regard to where the statements can occur in a program, not their fundamental difference of implementation and operation. The preprocessor is a text processor and it changes the code you have written by substitution; it is not part of the C language or your program.
Next we have a look at simple input/output statement and formatting strings. Of course this means we are dealing in different data types before they have been defined. Data types are introduced soon after and then, in quick succession, enumerations - why I'm not sure. After this we have operators, casting, if, switch, loops and storage classes. Not a logical order or mix, but they are all fundamental C.
The bitwise operators are discussed but bit manipulation is ignored. As C programmers often have to work with individual bits in complicated ways this is a big omission.
In this chapter we are told that other parts of the program can gain access to a variable either by it being global or passed as a parameter. True enough but there is no mention of the general idea that global variables are dangerous and to be avoided as much as possible.
The definition of a cast, which is hardly discussed, is wrong. The book has
but it is actually
There are also no examples of making use of it in ways that are typical of C programming.
The chapter finishes on a look at storage classes - again these topics could have been left until later.
I'm still wondering what:
"The keyword register refers to the social variables that are stored in the register."
means. What is a "social" variable? There are a few similar problems in understanding the meaning of explanations.
The next chapter is a big one titled "Arrays and Pointers" but it also covers a few other topics. In particular, it introduces strings, top down modular programming, functions, and parameter passing methods. There are lots and lots of worked examples, but this makes the chapter look even more off putting. Why these topics are lumped together in one big chapter I have no idea.
Chapter 4 is about structures and unions. Structures are important, but unions are often considered to be something that can be left for later.
The final chapter is on file handling. It goes over the usual file operations including how to read and write formatted data.
This is not a book I can recommend. It needs to be split into more chapters and it needs to be more logical in its presentation of topics. The copy editors also need to work over the language and the layout. For example, there are tables split across pages and the character used for an asterisk, an important operator in C, looks more like a footnote symbol. More importantly it needs to be more in keeping with modern C and typical uses of the language.
The book contains lots of example programs and exercises and this might appeal to some, but even here there are problems with the order of presentation with something involved in an early question being explained later. For example, Q8 on page 82 asks you to test for an Armstrong number, but what an Armstrong number is is is only defined on page 93.
There are also some places where C++ creeps in - for example Q3 on page 113 solves a problem using cout<<x and similar which is very much a C++ only construct and it appears without explanation or reference. I can only suppose that the example was constructed using a C++ compiler as if it was a C compiler.
Finally Q9 page 116 asks the reader to write a program to find the roots of a quadratic equation using switch statements and loops to display the result - despite thinking quite hard about it I can't see why you would need a switch statement or an if and what loops have to do with it is yet another mystery.
C Programming Absolute Beginner's Guide (3e) Rated 4.5 out of 5 by Mike James
21st Century C Rated 4.5 by Mike James
C Primer Plus, 6e Rated 4 by Mike James
Secure Coding in C and C++ 2nd Edition Rated 4.5 by Mike James
Programming in C (4e) Rated 4 by Alex Armstrong
|Last Updated ( Wednesday, 28 February 2018 )|