News for hackers. Stuff that matters.
Re:Poll: Do you know C? by tzs on Thursday April 07, 2011 @01:34PM (#2420350)
I wish more languages had books equivalent to K&R. Here's how I learned C.

1. Buy K&R.

2. Read it. Maybe 2 or 3 times during the process of reading it, I would go write a program to try what I had just learned. This was was around 1980, so trying a program meant walking across campus to a terminal. I could either head to the computing center and use a public terminal, or to the high energy physics building (where I had just started a work-study job programming and it required C). The former would mean competing for a free terminal--and annoying people if I was spending my time at the terminal mostly reading K&R instead of typing. The later meant sitting at a terminal next to a noisy minicomputer in a cold room.

When I got to the end of K&R, I was a C programmer in theory.

3. Start doing real work, using K&R as a reference.

Very quickly theory became aligned with reality, and I was then a C programmer in practice.

Nowadays, most programming books I find assume that I'm sitting eagerly at a computer as I read, and that I want to stop every three paragraphs and type in some code and run it, and then the book discusses what that code did with the author writing under the assumption that I have the output of the code on my screen.

I like the K&R way better.

Re:Poll: Do you know C? by SwellJoe on Thursday April 07, 2011 @03:07PM (#2420797)
I spent more than a decade (from the age of about 10) learning to program from a wide variety of books, about a variety of languages. I'd written software in Basic, Pascal, C, Amiga E, ARexx, and assembly. It wasn't until I read K&R in my mid-20s that it all actually started making sense (especially C, but everything made more sense after K&R). Up to that point, I'd been copy-paste programming, imitating, etc.

K&R is simply a brilliant programming text. It might just be the right learning model for me, and maybe others can learn as well from other books, but I'd read a dozen C programming books (all much thicker than K&R, but much less valuable) before K&R, and it never really took until K&R.

Re:Poll: Do you know C? by tjr on Thursday April 07, 2011 @05:45PM (#2421333)
Amiga E was one of the first programming languages I tried to learn. I had started with Apple BASIC, and happened to get a free Amiga E compiler and booklet on some Amiga magazine. The booklet left a lot to be desired; specifically, it showed how to do output but not input, and as a clueless novice BASIC programmer, I naively assumed that Amiga E could not do input.

I did not write much of interest using Amiga E, and that booklet was nowhere near as useful as K&R.

Re:Poll: Do you know C? by SwellJoe on Thursday April 07, 2011 @11:36PM (#2422320)
I started with probably the same booklet from probably the same magazine, but I also found a more complete reference making the rounds on local bulletin boards, so I was able to figure out input, and finally ordered the full language package from the author. Wouter van Oortmerssen is still working on nerdy pursuits, and created some other languages over the years, but none were as popular/successful as Amiga E. I made a small sample playback app with it, but my ambitions were far beyond my abilities.

I think it's primary reason for popularity was that it was so easy to use the Amiga GUI elements and other special features of the Amiga OS and hardware. I always had a hard time making stuff work in C, but could build a UI in no time in E.

Re:Poll: Do you know C? by jmspring on Friday April 08, 2011 @01:22AM (#2422562)
I've mentioned this in a previous thread awhile back. My father's approach to the question of "can I get some video games?" was to throw K&R at me and let me flounder.

Machines that I had at the time were a Trash80 something or other mostly running basic and an AT&T machine running some for of Unix...oh yeah.

But, I fought my way through K&R, multiple c compilers, assembler, etc. to actually learn something on these machines.

An interesting comment from an earlier discussion mentioned "this code (in C) is much cleaner than any C++ I have seen!". The truth is, if you know C, have a good style and discipline, you pretty much can produce more readable/reusable code than your normal c++ person.

Re:Poll: Do you know C? by justanotheratom on Thursday April 07, 2011 @02:29PM (#2420605)
I program primarily in C and believe I know all there is to know about it. But I have never read K&R. A few weeks back, I started reading it, got bored and gave up. But I keep running into people who swear by K&R. Do you guys think it is worth a read after the fact?
Re:Poll: Do you know C? by tomlogic on Thursday April 07, 2011 @07:00PM (#2421582)
Maybe not. If you're at that level, consider reading "The Standard C Library" by Plauger. I used it as a reference for updating a non-compliant library to be mostly compliant. I gained a better understanding of why the standard C library is the way it is, and learned how to implement all of it.
Re:Poll: Do you know C? by spc476 on Thursday April 07, 2011 @07:27PM (#2421674)
I've been programming in C since 1990, and I still use K&R, although it's mostly Appendix B (the Standard Library) at this point (I find it easier to read than the man pages). The only other C book I have (and consider worthwhile) is Plauger's _The Standard C Library_, not only for his implementation but for the history behind the Standard Library.
Re:Poll: Do you know C? by follower on Friday April 08, 2011 @12:31AM (#2422467)
I've never understood the love people seem to have for K&R--especially as a beginner text. In the end I put it down to learning approach differences.

A decade ago I thought the book "C Programming : A Modern Approach" by K.N. King was a good starter text--I don't know if there's a better recommendation that's more recent.

In terms of after the fact reading, if you like the terse style of K&R you might pick up something but if you got bored I suspect that means you don't like the style. I suspect the time might be better spent reading some code instead.

Re:Poll: Do you know C? by kqr2 on Thursday April 07, 2011 @03:34PM (#2420906)
Check out this previous thread: 32 years on, K&R's "The C Programming Language" still stands alone

http://news.ycombinator.com/item?id=1245255

Re:Poll: Do you know C? by samatman on Thursday April 07, 2011 @01:50PM (#2420435)
Exactly what I did, fifteen years later. I haven't programmed for anything but fun in ten years, but sometimes fun means C or dialects. It has a staying power in my mind that I attribute to the rigor both of the language and of K&R.

By contrast, I did Perl work for years, and went to script something in it recently. Quickly decided it would be easier to learn Python from scratch than to get my Perl chops back.

Re:Poll: Do you know C? by rajasharan on Thursday April 07, 2011 @04:27PM (#2421072)
Actually this is exactly how I started learning openGL. Be it a new language or new framework always follow these steps.

Read it. Maybe couple of times (say only chapters 1-3) in the beginning. Understand the basic mechanism first rather than try out a program copied from somewhere else.

Start testing out simple things.

I'm lucky to not have fallen for all the blog posts/tutorials on openGL where they spit out a C file and say to compile and run it.

Re:Poll: Do you know C? by yr on Thursday April 07, 2011 @05:32PM (#2421282)
I wish there was a K&R like book for every programming language.
Re:Poll: Do you know C? by Legion on Thursday April 07, 2011 @09:08PM (#2421963)
I liked The Ruby Programming Language book because they attempted to do just that. K&R is a good model for books to follow.
Re:Poll: Do you know C? by jc123 on Friday April 08, 2011 @01:34AM (#2422589)
K&R is best as a reference; especially for non-programmers, there are more effective ways to learn C and programming than K&R.
Re:Poll: Do you know C? by idonthack on Thursday April 07, 2011 @03:37PM (#2420918)
here is a link to the book tzs is talking about, for those who are interested

http://ifile.it/vo6ezb

Re:Poll: Do you know C? by peapicker on Friday April 08, 2011 @01:50PM (#2424891)
That copy is an illegal scan. There is no legal e-copy of K&R.