Ask HN: Should I learn C?
61–70 of 98 posts
Re: Ask HN: Should I learn C?
#62Absolutely, yes. + From the point of view of Python or Java (say), it's close enough to assembly language to let you understand how things might work; + If you need speed or control over hardware, sometimes it's your best route to extend whatever you're working in; + In many jobs you'll be the only one who has the knowledge to do unusual things, hence you'll be more valuable; + It gives you another point of view when…
I'm not sure about aiming for "pure" languages. Lisp is functional enough that one can learn pure functional programming using it, if he tries. And Ruby is OO enough that one isn't missing much, isn't it? Nothing wrong with the pure languages as options, just I think impure languages can fit the categories too.
I think that there's probably more (practical) benefit to be had with Ruby than Smalltalk or Self.
Re: Ask HN: Should I learn C?
#63Re: Ask HN: Should I learn C?
#64Yes, you should learn C. And enough assembly language to understand aspects of how C works, like what a "stack frame" is. Now is a great time to start. Go find K&R, fire up Linux and write and compile "hello, world". Then keep going until you experience your first segmentation fault. ;) (Do not study C++ at this point. Study C. These things turn out to be very very different.)
http://www.amazon.com/Reference-Manual-Samuel-P-Harbison/dp/...
Re: Ask HN: Should I learn C?
#65Yes, you should learn C. And enough assembly language to understand aspects of how C works, like what a "stack frame" is. Now is a great time to start. Go find K&R, fire up Linux and write and compile "hello, world". Then keep going until you experience your first segmentation fault. ;) (Do not study C++ at this point. Study C. These things turn out to be very very different.)
K&R refers to: The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie
http://www.amazon.com/exec/obidos/ASIN/0131103628/thedinosau...
Re: Ask HN: Should I learn C?
#66If you're going to read K&R, make sure you visit the Errata page. There are a bunch of examples that have typos (some of them are not on the Errata page though).
But reading one C book isn't going to teach you everything about C. A lot of the C code out there makes heavy use of macros and multiple pointer indirections, which isn't covered in much detail in K&R. And if you're interested in the newer C99 standard, The C Primer is a great book (but it's quite thorough, which imo, is a good thing).
If you're going to try out the examples from K&R, pass these arguments to gcc: -ansi -pedantic -Wall -Wextra -g
The -g flag is for debugging symbols. I think I still have most of the fixed examples from K&R that will compile, if you're interested in these. Also, make sure to bookmark these two links:
http://www.eskimo.com/~scs/cclass/krnotes/top.html
http://users.powernet.co.uk/eton/kandr2/
The first one gives you some better explanations of what has been said in the K&R book (divided by chapters). The second one has most answers to the exercises in the book.
Re: Ask HN: Should I learn C?
#67Yes, you should learn C. And enough assembly language to understand aspects of how C works, like what a "stack frame" is. Now is a great time to start. Go find K&R, fire up Linux and write and compile "hello, world". Then keep going until you experience your first segmentation fault. ;) (Do not study C++ at this point. Study C. These things turn out to be very very different.)
Re: Ask HN: Should I learn C?
#68Of course, it will also help if you start working on the following things, as they will show up in your classes. Don't worry if you don't understand it all right away, that's why you're going to college, right? :)
- How to debug (go read the book by Agans if you haven't already. It's short and fun to read.)
- How to do base conversions (eg. how do you convert decimal numbers to binary? decimal to hexadecimal?)
- How to work with sets (If you know how to work with list comprehensions or the set objects in python, or have played with SQL, that's quite handy)
- How to write a proof. (Here are some handy words to google for: "modus ponens", "modus tolens", "propositional logic", "truth table", "logical fallacies" and, once you get a feel for propositional logic, go look for "first order logic".)
- How a computer works at the level of logic gates. (Go play with the java applet "xLogicCircuits": http://math.hws.edu/TMCM/java/xLogicCircuits/ and see if you can figure out how to design a CPU. It can be pretty fun, although the applet's a little clunky.)
- What state machines are, and how they relate to regular expressions.
- While you're learning C, go look at assembly languages and see if you can understand the relation between C and assembly, and also between assembly and logic circuits.
- How to study and manage your time (Yeah, I'm still working on that one myself...) :)
Re: Ask HN: Should I learn C?
#69I, like many here, would strongly recommend learning C. I don't know if I'd call it "profitable" to do so at the moment, assuming you mean profitable in the money sense. C is a good language to learn, and a lot of interesting, well-paying jobs use C, and a lot of interesting open-source projects use C -- but if you just want to make steady cash, you can do so much easier with Java or PHP. That said, if you go about y…
Re: Ask HN: Should I learn C?
#70I would suggest Python and C, in that order. Python will let you quickly have fun building large applications, and it will teach you object oriented programming. Once you know what a loop is, though, go by "Advanced Programming in the Unix Environment" and a decent C book and trip out on that for a year or so to really understand how computers work. I don't write C for a living at all, but it is great to know how eve…
http://www.amazon.com/gp/offer-listing/0201563177/ref=dp_olp...