Alright, I'm doing it. I'm learning C. I mean, how hard can it be, riiiiiiight?

· · Web · 6 · 1 · 17

What are your favorite resources to learn C? So far I've got some 1000 page manual, which is thorough, but not overly exciting.

@rostiger It's easy! I swear! It's like shelves! Ah ah ah... *shivers in pointers*

@rostiger Learn C. Suffer with C. Drop C. Learn Go. Embrace Go. Love Go.

@rostiger it's not too hard, and a whole bunch of people are learning it at the same time. It's a good window to do it.

@rostiger has an interactive editor to try things as you learn in browser (a bit slow for my taste) - lots of examples - compare solutions between languages

@tbd Oh, programiz looks quite nice, thanks! Also Rosettacode will surely come in handy. I tried learn-c but it didn't click with me.

@rostiger I feel I learned the most when I sat down with The C Programming Language and forced myself to do all the exercises, etc.

If you start with gcc or clang in old-C settings so that the book code compiles quietly, the next step would be putting your compiler in a pedantic and more recent standard mode and trying to get it to compile without warnings

Lots of potential learning and will cover more or less all of how the language itself works

@rostiger I still like Kernighan and Ritchie. It is a very concise book. I heard "C Programming: A modern approach" by King to be a good book too, though I do not have any experience with it.

If you plan to pick up K&R, I suggest attempting the exercises. I remember that they were very good ones.

@rostiger seconding @vu3rdd and @henesy here. Pick up K&R and don't bother with anything else, at least not until you've finished it. Not sure why it doesn't get recommended as often these days. Seems like too "obvious" of a choice? Or too old?

I know Zed Shaw wrote a thing about K&R being horrible, and he was kind of right on details but mostly wrong. Kernighan is a great teacher, and K&R is one of the best examples of technical writing I've ever seen.

@rostiger what K&R doesn't teach you is anything about Makefiles or build tooling or anything like that which you'll encounter in practice—it really is just about C as a programming language + some UNIX fundamentals, since C and UNIX were made for each other.

This omission is one of its strengths. It's why it has held up over the last 32+ years in a way that wouldn't be possible otherwise.

@rostiger Seconding everything @colby said. Another of my favourite books is "Software tools" book by Kernighan and Plauger. It talks about writing little tools (mostly reimplements unix command line tools in say core-utils or any Unix userland) in .. Pascal. A good exercise after learning some C from K&R would be to reimplement them in C.

@vu3rdd @colby Thanks for the recommendation - the book is even available at my local library, so I'll make sure to check it out!

spoiler; don't read this until if/when you hit a brick wall at that one place 

@rostiger Hey! I meant it. You're not supposed to open the envelope unless/until you actually need it.

The key (in ROT-13): whfg fgvpxvat jvgu vg. Vs lbh arrq gb, frg vg nfvqr sbe n pbhcyr jrrxf orpnhfr bs Puncgre 5, gura tb jbex ba fbzr bgure fghss sbe n juvyr naq pbzr onpx naq fgneg sebz gur ortvaavat.

@rostiger get a concrete project and learn on the way. Definitely the most fun.

@koloman That's anyway how I usually end up doing it. Also learning it for a very specific usecase. I mainly have to wrap my head around pointers and string manipulation, then I'll be good to go! (famous last words...)

Sign in to participate in the conversation

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.