pandit wrote:
is this book good for learning C ?
i am a beginning programmer, Kernighan and Ritchie 2e is quite hard on
me.
Yes, I think it's good. It's the book I recommend most often, even over
K&R2.
I learned C in 1990, when the 2nd editions of both Kelley and Pohl and
K&R were released. My memory of that time is that I found K&R2 opaque
and confusing. It seems very clear to me when I read it *now*, but I
trust my memory of what it seemed like before I knew the language.
Kelley and Pohl covers very similar territory, and I think either book
can serve as an excellent reference, but Kelley and Pohl does a better
job of *teaching*.
Compare these two descriptions of the #include <stdio.hline in the
very first program example from each book.
K&R2 (p 6):
The first line of the program,
#include <stdio.h>
tells the compiler to include information about the standard input/
output library; this line appears at the beginning of many C source
files. The standard library is described in Chapter 7 and Appendix
B.
Kelley and Pohl (2nd ed, p 5):
#include <stdio.h>
A preprocessor is built into the C compiler. When the command to
compile a program is given, the code is first preprocessed, and then
compiled. Lines that begin with a # communicate with the preproces-
sor. This #include line causes the preprocessor to include a copy of
the header file stdio.h at this point in the code. This header file
is provided by the C system. The angle brackets around <stdio.h>
indicate that this file is to be found in the "usual place," which is
system dependent. We have included this file because it contains
information about the printf() function.
It takes only until p. 10 in Kelley and Pohl to find a more detailed
explanation of #include and .h files. This discussion doesn't occur in
K&R2 until p. 88.
K&R2 is intentionally vague about topics that the authors wish to defer
to later discussion. This makes many aspects of the language seem
deeply mysterious in the early stages of learning it. When the later
discussion is finally encountered--if you last that long--it is often
encumbered by technicalities that further confuse the beginner.
- Ernie
http://home.comcast.net/~erniew