News for hackers. Stuff that matters.
Re:Modern C, Second Edition by AlexeyBrin on Wednesday September 18, 2019 @02:09PM (#21008219)
C Programming: A Modern Approach, 2nd Edition by King is a good beginner book.

21st Century C by Ben Kelemens is also a good book.

Re:Modern C, Second Edition by learc83 on Wednesday September 18, 2019 @02:17PM (#21008311)
> 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.

Re:Modern C, Second Edition by afroisalreadyin on Wednesday September 18, 2019 @02:59PM (#21008741)
I 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.
Re:Modern C, Second Edition by feanaro on Thursday September 19, 2019 @02:27AM (#21013814)
Huh? 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?
Re:Modern C, Second Edition by flukus on Wednesday September 18, 2019 @08:20PM (#21011957)
Thirded, 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), 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).
Re:Modern C, Second Edition by RhysU on Thursday September 19, 2019 @08:15AM (#21015426)
Glad it has been of use!
Re:Modern C, Second Edition by armitron on Thursday September 19, 2019 @01:22AM (#21013516)
Read 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.
Re:Modern C, Second Edition by psibi on Thursday September 19, 2019 @02:17AM (#21013766)
For others, this is the review that the OP seems to be speaking about: https://www.amazon.com/gp/customer-reviews/R3IQKSK19FIEI5?re...
Re:Modern C, Second Edition by kimown on Wednesday September 18, 2019 @09:35PM (#21012375)
An Introduction to C & GUI Programming - Simon Lon is also good for beginners, especially it's easy understand content and beautiful typographic style.
Re:Modern C, Second Edition by Apocryphon on Wednesday September 18, 2019 @03:12PM (#21008865)
How about Zed Shaw's Learn C the Hard Way?
Re:Modern C, Second Edition by saagarjha on Wednesday September 18, 2019 @06:53PM (#21011311)
I'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.
Re:Modern C, Second Edition by braindeath on Wednesday September 18, 2019 @09:59PM (#21012508)
I 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-schoo...

Re:Modern C, Second Edition by ScottFree on Wednesday September 18, 2019 @03:57PM (#21009396)
I 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.

Re:Modern C, Second Edition by tom_mellior on Thursday September 19, 2019 @05:18AM (#21014585)
Wait 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?
Re:Modern C, Second Edition by ScottFree on Thursday September 19, 2019 @06:10AM (#21014850)
Like 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.

Re:Modern C, Second Edition by tom_mellior on Thursday September 19, 2019 @07:45AM (#21015288)
> 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?

Re:Modern C, Second Edition by ScottFree on Thursday September 19, 2019 @08:03AM (#21015369)
I'm not interested in continuing this line of conversation. Read the book if you want to know more.
Re:Modern C, Second Edition by tom_mellior on Thursday September 19, 2019 @05:17AM (#21014582)
Here'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