Earlier quoted context omitted.
People don't like K&R? I can understand it not being suitable for children and the very beginner, but it's one of a very few programming books that is useful, succinct, pragmatic, doesn't get bogged down in APIs, and is written clearly. (The companion book "Programming in the UNIX environment" is the get-you-started guide from the very beginning, although it assumes 1970s terminal defaults)
K&R is the best second C programming book.
Where to begin when learning C? Start by making lots of errors
61–70 of 90 posts
Re: Where to begin when learning C? Start by making lots of errors
#62Earlier quoted context omitted.
"Programming is learned by writing programs" - Brain Kernighan And that is what anyone who goes through K&R will do: Reading and writing lots of real programs. A simple program is worth a thousand words! Which unfortunately the majority of technical books just can't get right. Explain the concepts in 5 full dull pages, and then at the end "Hey, checkout this little snippet of code, which by the way does nothing reall…
> A simple program is worth a thousand words! Whereas, the less said about complicated code, the better.
Re: Where to begin when learning C? Start by making lots of errors
#63Re: Where to begin when learning C? Start by making lots of errors
#64Earlier quoted context omitted.
"Programming is learned by writing programs" - Brain Kernighan And that is what anyone who goes through K&R will do: Reading and writing lots of real programs. A simple program is worth a thousand words! Which unfortunately the majority of technical books just can't get right. Explain the concepts in 5 full dull pages, and then at the end "Hey, checkout this little snippet of code, which by the way does nothing reall…
I'd like to add some emphasis on reading . For a beginner, writing is obviously very very important as the way to get to the point where he can just sit down and solve a given task. But reading lots and lots of code (from many different sources) will help him pick up idioms and find common & good solutions to specific problems. Even for a smart person, I think it'll take a lot of time and effort to arrive to the clea…
It takes a large volume of work to really get into programming, and I think that reading is easier than writing, so it's a fast way to dig in (keeping in mind that feedback is critical - so reading without writing has severe diminishing returns)!
Re: Where to begin when learning C? Start by making lots of errors
#65Install Valgrind. It makes error messages a lot less cryptic (my #1 problem with C... not that's it's limited to C). If you don't get proper feedback, it's not learning, just banging your head against the wall.
I've had a heck of a time getting Valgrind working on a mac (especially since Mavericks), hardly finding any resources about it. Is there an alternative, or do you have any advice on getting it to work?
Re: Where to begin when learning C? Start by making lots of errors
#66Re: Where to begin when learning C? Start by making lots of errors
#67This situation is why there is "hello world"; that program seems trivial but actually has important implications; for instance, that your environment works, that you know how to feed programs to the compiler, that you can actually run the output. I never took "hello world" seriously until I started doing embedded systems work; it's now an extraordinarily important tool for me (I work an anomalously weird number of di…
Re: Where to begin when learning C? Start by making lots of errors
#68This situation is why there is "hello world"; that program seems trivial but actually has important implications; for instance, that your environment works, that you know how to feed programs to the compiler, that you can actually run the output. I never took "hello world" seriously until I started doing embedded systems work; it's now an extraordinarily important tool for me (I work an anomalously weird number of di…
I once had a particularly slow week at work, and decided to write an article about how "Hello World" works in C. How it really works -- including compiling, linking, system calls, operating system involvement, hardware I/O, communication between ICs, etc. The path from the block of text to photons emitting from the screen, with fairly detailed explanations at every level. I ended up with a 50 page LaTeX document that…
It takes on an even simpler program, namely:
int main() {
return 42;
}
But digs in the C runtime, Linux kernel and touches on compilers, linkers and loaders.Hope it's helpful
Re: Where to begin when learning C? Start by making lots of errors
#69This situation is why there is "hello world"; that program seems trivial but actually has important implications; for instance, that your environment works, that you know how to feed programs to the compiler, that you can actually run the output. I never took "hello world" seriously until I started doing embedded systems work; it's now an extraordinarily important tool for me (I work an anomalously weird number of di…
I once had a particularly slow week at work, and decided to write an article about how "Hello World" works in C. How it really works -- including compiling, linking, system calls, operating system involvement, hardware I/O, communication between ICs, etc. The path from the block of text to photons emitting from the screen, with fairly detailed explanations at every level. I ended up with a 50 page LaTeX document that…
That reminds me of JBQ's blog post from shortly after Dennis Ritchie's death: https://plus.google.com/112218872649456413744/posts/dfydM2Cn...
I would love to see that document if you still have it.
Re: Where to begin when learning C? Start by making lots of errors
#70A minor point, but important to understand: the error came from the linker, not the compiler. It compiled just fine.
Didn't someone win a IOCCC some years ago by providing an empty file that got compiled successfully?