7 ms·
What book would you recommend as an alternative?
by tym0 7y ago
What book would you recommend as an alternative?
- jacobkg 7y agoI learned C from “C Primer Plus” about a decade ago and I thought it was terrific: C Primer Plus (6th Edition) (Developer's Library) https://www.amazon.com/dp/0321928423/ref=cm_sw_r_cp_api_i_bgNGDb3GWV3VF https://www.amazon.com/dp/0321928423/ref=cm_sw_r_cp_api_i_bg...
- AlexeyBrin 7y agoC Programming: A Modern Approach, 2nd Edition by King is a good beginner book. 21st Century C by Ben Kelemens is also a good book.
- learc83 7y ago> C Programming: A Modern Approach, 2nd Edition by King is a good beginner book. I would recommend that as well. Dr. King was one of my favorite professors, but I bought that particular book on my own.
- Apocryphon 7y agoHow about Zed Shaw's Learn C the Hard Way?
- ScottFree 7y agoI just finished Learn C the Hard Way and would be interested in a comparison between it and those other books mentioned. Just from a quick glance, Modern C appears to be a much more in depth book. It appears to cover things like memory alignment, advanced types like unions, malloc, threads, etc. Learn C the Hard Way is more of a quick introduction. You learn the basics, like pointers, basic data structures, basic types and then learn to do something interesting with those basics (build a web server). It also teaches some valuable real life practices that Modern C doesn't touch on, like how to structure your project, makefiles, how to use Valgrind and gdb.
- tom_mellior 7y agoWait what, Learn C the Hard Way doesn't teach malloc? Programming without dynamic memory allocation is pretty restrictive. What "data structures" does it even teach if it doesn't cover malloc?
- ScottFree 7y agoLike I said, it teaches the basics. There's a single page on heap vs stack allocation and it says malloc allocates memory to the heap. That's it. That's all you really need to know to do stuff and it doesn't go into what malloc actually does under the hood. Modern C has an entire chapter called "malloc and friends" where it goes into much more depth about malloc, calloc, realloc, etc. The book is a good introduction to programming in C and I'm glad I read it. You obviously have a history with the author and I'll thank you to keep your past impressions out of this particular discussion.
- tom_mellior 7y ago> There's a single page on heap vs stack allocation and it says malloc allocates memory to the heap. That's it. That's all you really need to know to do stuff Every other C book seems to disagree, but OK. Does the book cover the -> operator? Does it mention free and realloc? You need those to do stuff, at least. > You obviously have a history with the author How is this obvious, since it is incorrect?
- ScottFree 7y agoI'm not interested in continuing this line of conversation. Read the book if you want to know more.
- saagarjha 7y agoI've only skimmed the book, but I wouldn't recommend it. The author has a tendency to be snarky and come up with "fixes" for "mistakes" that "old" C programmers make, except he does so in a way that is at odds with the fundamental design of C constructs and does not really show a correct understanding of undefined behavior.
- braindeath 7y agoI vaguely recall the whole fallout where it was revealed he clearly did not understand undefined behavior, and I believe he did walk back and accept his misunderstanding. That said, yes it is damned annoying to have someone that doesn't understand the intricate details of the language poop all over that community and act as if "well i've contributed lots of code in C, why listen to a bunch of language lawyers, that isn't important anyway" as if the two are mutually exclusive. There are some of us that have been using C for years for actual work and are also intricately familiar with the prickly details of the standard. Those are the people that you should be looking for C books. Zed Shaw consistently shows he would rather hear the sound of his own voice and diminish things that are uninteresting to him rather than put in that work to become an expert on all facets of the topic he is claiming expertise. https://what.thedailywtf.com/topic/16422/zed-shaw-gets-schooled-on-c-undefined-behavior https://what.thedailywtf.com/topic/16422/zed-shaw-gets-schoo...
- tom_mellior 7y agoHere's an old critique, but based on everything I've ever read from or about Zed Shaw, I trust that it's still valid: http://hentenaar.com/dont-learn-c-the-wrong-way http://hentenaar.com/dont-learn-c-the-wrong-way
- afroisalreadyin 7y agoI would second 21st Century C, it's an excellent book. It has a very pragmatic approach, skipping features like unions that are not used in modern C, but going into great detail on the important things like memory management.
- flukus 7y agoThirded, especially on the pragmatism, this by far the most pragmatic programming book I've ever read. I fell in love with the C as a scripting language parts (https://github.com/RhysU/c99sh https://github.com/RhysU/c99sh), now I don't have much of a use for a scripting language to sit between bash and "proper language" (apart from some occasional awk).
- RhysU 7y agoGlad it has been of use!
- armitron 7y agoRead the reviews on Amazon. It's not a good book, the author makes embarrassing mistakes to the point where you start questioning his programming knowledge.
- psibi 7y agoFor others, this is the review that the OP seems to be speaking about: https://www.amazon.com/gp/customer-reviews/R3IQKSK19FIEI5?ref=pf_vv_at_pdctrvw_srp https://www.amazon.com/gp/customer-reviews/R3IQKSK19FIEI5?re...
- feanaro 7y agoHuh? Since when are unions not used in modern C? Tagged unions are a really common pattern in language interpreters. What are they supposed to be replaced with?
- kimown 7y agoAn Introduction to C & GUI Programming - Simon Lon is also good for beginners, especially it's easy understand content and beautiful typographic style.
- whydoyoucare 7y agoThe C language can be best learned from "The C Programming Language, 2nd Ed" [1], also known as "K&R book". Pair it with excellent notes by Steve Summit [2], and you don't need any other book to master C. [1] https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628 https://www.amazon.com/Programming-Language-2nd-Brian-Kernig... [2] https://www.eskimo.com/~scs/cclass/notes/top.html https://www.eskimo.com/~scs/cclass/notes/top.html
- boring_twenties 7y agoNo doubt K&R is second to none, but it only covers C89. Since then we have 99, 11 and apparently now 17 too?
- whydoyoucare 7y agoA useful approach is to learn 95% of the language from K&R, and then refer to the newer standards for the incremental changes. If there is a book as good as K&R and covers the new ideas, I'm interested to learn about it! :-)
- ndesaulniers 7y agoMy two favorite C books are: Head First C by Griffiths and Griffiths and Expert C Programming: Deep C Secrets by van der Linden
- nineteen999 7y agoLove Deep C Secrets. I have it and flick through it whenever I want to remind myself about the dark corners I never mastered during the last 20 years of programming in C.