7 ms·
Yes, 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
by mechanical_fish 16y ago
Yes, 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.)
- jolan 16y ago> Then keep going until you experience your first segmentation fault. Or your first cryptic compiler error. I'm pretty sure mine was "numeric constant contains digits beyond the radix".
- riso 16y agoA good book that goes over both C and assembly is "Hacking: The Art of Exploitation". The first 100 pages alone will give you a solid understanding of what is happening behind the code.
- swolchok 16y agoI can't recommend that book for learning C and assembly. Its coverage is amateurish and unprofessional, which are indicative of or at least encourage fuzzy thinking. You can read it for a time-efficient overview, but please don't go thinking you know C or assembly if that's all you've read.
- riso 16y agoFor clarification, the recommendation was not for learning C and assembly, but rather to get a good feel for what is happening at a lower level ie. stack frames, stack pointers, etc.
- sreque 16y agoAt my university we have a course that goes over all the levels of abstraction between the hardware and systems-level UNIX programming. I never took the class, but I followed the course book on my own and it proved to be one of the most enlightening self-learning experiences I've had with programming. The book is Computer Systems: A Programmer's Perspective, and I highly recommend it. I've found that even though I now spend most of my time programming in higher level languages, my understanding of C and assembly, compilers and debuggers, the virtual memory model and system memory hierarchy, and CPU architecture are still very valuable in helping me reason about my code and how it interacts with the rest of the system. I also still have developers at work on the C development team occasionally come ask me code questions, and often the answers to their questions come down to understanding one of the above better. If you can master multiple levels of abstraction you will be a much more effective developer.
- TeHCrAzY 16y agoISBN for anyone interested: 978-0130340740
- Goladus 16y agoFor learning C I strongly recommend C: A Reference Manual (Harbison and Steele), not K&R. Read K&R for context, sure, but Harbison and Steele is more up-to-date and comprehensive while still a concise language reference. That book can basically answer almost any question about the language standard that isn't compiler-specific. http://www.amazon.com/Reference-Manual-Samuel-P-Harbison/dp/013089592X http://www.amazon.com/Reference-Manual-Samuel-P-Harbison/dp/...
- silentbicycle 16y agoRead both, and then C Interfaces & Implementations by Hanson. Best advanced C book, ever!
- awongh 16y agosince I had to look it up, maybe others don't know: K&R refers to: The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie http://www.amazon.com/exec/obidos/ASIN/0131103628/thedinosaurrea0a http://www.amazon.com/exec/obidos/ASIN/0131103628/thedinosau...
- SwellJoe 16y agoI feel compelled to add that I tried to learn C from a half dozen other books over several years (starting in childhood, so it was probably a bit early), but it never made any sense until I worked through K&R. Suddenly, C seemed like a beautiful and simple language (which it is). There are many subtleties, particularly in the macro system, that are not covered at all by K&R, but it is, by far, the best choice for learning C. In other words: Don't waste your time trying to learn from anything other than K&R, at first. It's just the most concise text available...C is a concise language, and it is not well-served by big fat books.
- awongh 16y agoYou, and it seems most others here are suggesting that you learn C by doing some systems programming; I was thinking of dabbling in C, but maybe starting out by doing something with AVR/arduino or something like that.... Is the C your write for embedded stuff fundamentally different from the C you write for linux? I would eventually like to know how to write a php module or something like that, is starting by hacking on linux or some other os a better start?
- Rusky 16y agoI think the real value of C is how it deals with lower-level stuff- embedded systems, drivers, kernels, etc. Writing something like a PHP module would make more sense in another language (and then wrapping it in C if you need to).
- SamAtt 16y agoI'm sorry but I think this is bad advice. I'm not against learning C in general. I think everyone should. But his question isn't should he learn C ever it's should he learn it in his spare time between High School and College The best thing I did for myself during college was to program on my own time in languages that people use out in the world. Learning C, Assembly, Data Structures and all the rest is great but when you get out into the world it helps to have been programming in Python or Ruby for 4 years and be experienced in that. So I say "No". Learn C in school but in your free time I suggest you learn Python (Here's a great starter book I used when I taught a class on it: http://www.amazon.com/Python-Programming-Absolute-Beginner-3rd/dp/1435455002/ref=sr_1_4?ie=UTF8&s=books&qid=1279478383&sr=1-4 http://www.amazon.com/Python-Programming-Absolute-Beginner-3...)
- lukeqsee 16y agoI already am fluent in Python. I've used it in real world stuff for 2 years. I also am in the midst of learning Ruby (with _Why's guide).