Found in 30 comments on Hacker News
redis_mlc · 2021-04-23 · Original thread
Just learn C by reading and working through the K&R book. (It's one of the best CS books ever written.)

https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

Also, there's nothing magical about pointers - scripting languages use "handles", which is the same thing except they're read-only to the end-user programmer.

The real challenge with C is multi-threaded programming, so don't do that if you don't need it.

_osorin_ · 2022-10-08 · Original thread
I would like to take it a step further and ask a question that has been bothering me a while. On my time in the academy I studied the following two books (regarding C):

[1] Advanced Programming in the UNIX Environment https://www.amazon.com/Advanced-Programming-UNIX-Environment...

[2] C Programming Language https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

In combination with other classes (and books) on networking, operation systems, data structures we covered a big variance of use cases with C. My question is: How do I take this to the next level? For example I feel I never missed a concept from those classes but when I see C code posted on a thread here it's probably something completely unreadable and complex. Can anyone provide resources to advance a little? What should I study if my goal is to make good and useful modern C software?

I feel like my typing is a bit abstract but I will be happy to clarify.

PS Yes, I've heard of C++ and Rust ;P

whydoyoucare · 2019-12-03 · Original thread
As far as I know, prices of books differ between rich and developing nations. For e.g., The C Programming Language that costs $50 in the US [1], is sold for Rs. 259 (~$4 US) in India. I believe that is the case with most "economy editions" specifically targeted at developing nations. It certainly isn't an "year's wages".

While I do understand your point, it still does not justify encouraging modern-day Robinhoods' and breaking the law.

[1] https://www.amazon.com/Programming-Language-2nd-Brian-Kernig... [2] https://www.amazon.in/Programming-Language-Kernighan-Dennis-...

lossolo · 2017-05-07 · Original thread
I don't share your opinion and most people I know that do C do not share it also. It's good base to get familiar with language, no one say you can't expand your knowledge further after reading this book.

I've read some other "modern" books about C like "21st century C" but they are not for people that do not know C and they are not so good for people that know it.

Can you provide any arguments to support what you wrote? What alternative you would propose for learning C?

https://www.amazon.com/Programming-Language-Brian-W-Kernigha...

Read what majority of opinions say. It's really easy to criticize without giving better alternative.

jasonlhy · 2017-04-20 · Original thread
C is a very "strict" language. It do the right thing only if you write the right code. It has many undefined behaviors. One of the undefined behaviors I found when I studied the compiler course. The purposed grammar from https://www.amazon.com/Programming-Language-Brian-W-Kernigha... allows this kind of structure, there can be statements after the switch but before the case labels. gcc also accepts this, but those statements will not be executed. Note: code modified from https://www.tutorialspoint.com/cprogramming/switch_statement...

#include "stdio.h"

int main () {

   /* local variable definition */
   char grade = 'B';
   int a = 1;

   switch(grade) {
      printf("great!\n" );
      a = a + 1;
      
      case 'A' :
         printf("Excellent!\n" );
         break;
      case 'B' :
      case 'C' :
         printf("Well done\n" );
         printf("a: %d\n", a);
         break;
      case 'D' :
         printf("You passed\n" );
         break;
      case 'F' :
         printf("Better try again\n" );
         break;
      default :
         printf("Invalid grade\n" );
   }
   
   printf("Your grade is  %c\n", grade );
 
   return 0;
}

pdog · 2016-12-22 · Original thread
Why did people think otherwise? Chapter 5 of K&R[1] is titled Pointers and Arrays and basically explains that arrays and pointers are equivalent.

[1]: https://www.amazon.com/Programming-Language-Brian-W-Kernigha...

bra-ket · 2016-10-08 · Original thread
I learned programming without a computer in the 90s with Kernigan & Ritchie "C Programming Language", one of the best coding books ever written:

https://www.amazon.com/Programming-Language-Brian-W-Kernigha...

I'd also learn SICP: https://www.amazon.com/Structure-Interpretation-Computer-Pro...

and algorithms from either CLRS https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press... or Skiena Algorithm Design https://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena...

What's the rush?

http://norvig.com/21-days.html

Learning C is difficult because you need to know how the machine actually works. Trust me, there are no shortcuts. The year can be 2036, learning C will be the same.

With that said, these books are excellent:

http://www.amazon.com/Programming-Language-Brian-W-Kernighan...

http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp...

http://www.amazon.com/Primer-Plus-6th-Developers-Library/dp/...

percept · 2016-03-04 · Original thread
I looked forward to a complete chapter on IO (not unlike http://www.amazon.com/Programming-Language-Brian-W-Kernighan...), but didn't see one.

Perhaps a future edition...

echeese · 2015-06-23 · Original thread
You can get a copy here: http://www.amazon.com/dp/0131103628
sgt · 2015-03-05 · Original thread
For those of you who are not familiar with "The C Programming Language" (also written by Kernighan), see: http://www.amazon.com/C-Programming-Language-2nd/dp/01311036...
kgabis · 2014-06-24 · Original thread
It was released years ago: http://www.amazon.com/dp/0131103628
angersock · 2013-11-15 · Original thread
Some helpful starting points:

Learn about the Unix Way: http://c2.com/cgi/wiki?UnixWay

Learn about crufty neckbeard stuff: http://doc.cat-v.org/programming/

(cat-v has all kinds of interesting things)

Learn C: http://c.learncodethehardway.org/book/

No, really, learn C: http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/...

Learn about networking with sockets: http://www.beej.us/guide/bgnet/

(it's in C, but the principles are in other language bindings as well)

Devops/sysadminning is mostly just damned superstition and voodoo and hard-fought experience...that said, consult notes from others: http://users.cis.fiu.edu/~tho01/psg/

~

If you want more hands-on experience, setup a VPS and make something: http://feross.org/how-to-setup-your-linode/

If you find stuff in there you don't understand, ask your devs for help.

chadnickbok · 2013-06-02 · Original thread
As many people have said, no, you're not too old to get started. And despite what some people might say, a multi-year degree program, with a decent GPA, is a great way of showing employers that you're a decent potential candidate.

That said, software engineering is one of the fields you can get employment without a degree, provided you can 'show your work'. The hard part is building up your skills in a way that can easily be demonstrated. The common wisdom these days is to create a github profile, build some interesting things, commit to some open-source libraries, and use your profile as a resume of sorts.

Here's interesting article on being a well-rounded programmer: http://jasonrudolph.com/blog/2011/08/09/programming-achievem...

We're also in a 'golden age' of self-guided learning, with online tools to help learning galore, here are a few:

http://codecademy.com http://www.codeschool.com/ https://www.khanacademy.org/cs

Also, get a few decent books on "Programming 101". Common wisdom suggests you learn C, one of Ruby/Python, Java, and a functional language like Haskell. Here are some good books to learn from:

The C Programming Language (some people say you should start here, I'm one of them!): http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...

Learning Python: http://www.amazon.com/Learning-Python-Powerful-Object-Orient...

Learning Java: http://www.amazon.com/Learning-Java-Patrick-Niemeyer/dp/0596...

I hope you do choose programming as a career, its been very rewarding for me :)

robomartin · 2012-11-27 · Original thread
OK, if you don't have any real experience in low-level embedded coding (relevant to device drivers), RTOS or OS design in general, file systems, data structures, algorithms, interfaces, etc. And, if you have "hobby level" experience with Assembler, C and C++. And, if your intent is to write a desktop OS, from the ground up, without making use of existing technologies, drivers, file systems, memory management, POSIX, etc. Here's a list of books that could be considered required reading before you can really start to write specifications and code. Pick twenty of these and that might be a good start.

In no particular order:

1- http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/...

2- http://www.amazon.com/The-Answer-Book-Solutions-Programming/...

3- http://www.amazon.com/The-Standard-Library-P-J-Plauger/dp/01...

4- http://www.amazon.com/C-Traps-Pitfalls-Andrew-Koenig/dp/0201...

5- http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp...

6- http://www.amazon.com/Data-Structures-In-Noel-Kalicharan/dp/...

7- http://www.amazon.com/Data-Structures-Using-Aaron-Tenenbaum/...

8- http://www.amazon.com/Mastering-Algorithms-C-Kyle-Loudon/dp/...

9- http://www.amazon.com/Code-Complete-Practical-Handbook-Const...

10- http://www.amazon.com/Design-Patterns-Elements-Reusable-Obje...

11- http://www.amazon.com/The-Mythical-Man-Month-Engineering-Ann...

12- http://www.amazon.com/The-Programming-Language-4th-Edition/d...

13- http://www.amazon.com/The-Standard-Library-Tutorial-Referenc...

14- http://www.amazon.com/API-Design-C-Martin-Reddy/dp/012385003...

15- http://www.amazon.com/The-Linux-Programming-Interface-Handbo...

16- http://www.amazon.com/Computer-Systems-Programmers-Perspecti...

17- http://www.amazon.com/System-Programming-Unix-Adam-Hoover/dp...

18- http://www.amazon.com/Memory-Programming-Concept-Frantisek-F...

19- http://www.amazon.com/Memory-Management-Implementations-Prog...

20- http://www.amazon.com/UNIX-Filesystems-Evolution-Design-Impl...

21- http://www.amazon.com/PCI-System-Architecture-4th-Edition/dp...

22- http://www.amazon.com/Universal-Serial-System-Architecture-E...

23- http://www.amazon.com/Introduction-PCI-Express-Hardware-Deve...

24- http://www.amazon.com/Serial-Storage-Architecture-Applicatio...

25- http://www.amazon.com/SATA-Storage-Technology-Serial-ATA/dp/...

26- http://www.amazon.com/Beyond-BIOS-Developing-Extensible-Inte...

27- http://www.amazon.com/Professional-Assembly-Language-Program...

28- http://www.amazon.com/Linux-Kernel-Development-3rd-Edition/d...

29- http://www.amazon.com/Version-Control-Git-collaborative-deve...

30- http://www.amazon.com/Embedded-Software-Primer-David-Simon/d...

31- http://www.amazon.com/Programming-Embedded-Systems-C/dp/1565...

32- http://www.amazon.com/Making-Embedded-Systems-Patterns-Softw...

33- http://www.amazon.com/Operating-System-Concepts-Abraham-Silb...

34- http://www.amazon.com/Performance-Preemptive-Multitasking-Mi...

35- http://www.amazon.com/Design-Operating-System-Prentice-Hall-...

36- http://www.amazon.com/Unix-Network-Programming-Sockets-Netwo...

37- http://www.amazon.com/TCP-Illustrated-Volume-Addison-Wesley-...

38- http://www.amazon.com/TCP-IP-Illustrated-Vol-Implementation/...

39- http://www.amazon.com/TCP-Illustrated-Vol-Transactions-Proto...

40- http://www.amazon.com/User-Interface-Design-Programmers-Spol...

41- http://www.amazon.com/Designing-Interfaces-Jenifer-Tidwell/d...

42- http://www.amazon.com/Designing-Interfaces-Jenifer-Tidwell/d...

43- http://www.amazon.com/Programming-POSIX-Threads-David-Butenh...

44- http://www.intel.com/p/en_US/embedded/hwsw/software/hd-gma#d...

45- http://www.intel.com/content/www/us/en/processors/architectu...

46- http://www.intel.com/p/en_US/embedded/hwsw/hardware/core-b75...

47- http://www.hdmi.org/index.aspx

48- http://en.wikipedia.org/wiki/Digital_Visual_Interface

49- http://www.amazon.com/Essential-Device-Drivers-Sreekrishnan-...

50- http://www.amazon.com/Making-Embedded-Systems-Patterns-Softw...

51- http://www.amazon.com/Python-Programming-Introduction-Comput...

52- http://www.amazon.com/Practical-System-Design-Dominic-Giampa...

53- http://www.amazon.com/File-Systems-Structures-Thomas-Harbron...

54- ...well, I'll stop here.

Of course, the equivalent knowledge can be obtained by trial-and-error, which would take longer and might result in costly errors and imperfect design. The greater danger here is that a sole developer, without the feedback and interaction of even a small group of capable and experienced programmers could simply burn a lot of time repeating the mistakes made by those who have already trenched that territory.

If the goal is to write a small RTOS on a small but nicely-featured microcontroller, then the C books and the uC/OS book might be a good shove in the right direction. Things start getting complicated if you need to write such things as a full USB stack, PCIe subsystem, graphics drivers, etc.

kaolinite · 2012-03-08 · Original thread
As you're interested in electronics you may be interested in Arduino, which you can program in C (and perhaps some other languages too). If you do decide to pick C, I'd really recommend picking up a copy of K&R's "The C Programming Language": http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/...

You're also interested in games, so you could consider Python and the PyGame library: http://www.pygame.org/ Or if you want to go with C, try the allegro library: http://alleg.sourceforge.net/index.html (Learning this library was what taught me C, after picking up the basics of C I picked up the rest as I went along).

End of the day though, just pick something and learn it. It's better to be learning than worrying about what to learn.

whamill · 2012-02-10 · Original thread
Basically the book for that language which is considered 'The Bible' by its developers. The K&R book for C (http://www.amazon.co.uk/C-Programming-Language-2nd/dp/013110...) or the Camel book for Perl (http://www.amazon.co.uk/Programming-Perl-Theres-More-Than/dp...) are this type of book.
andymoe · 2011-11-07 · Original thread
Joel likes the sink or swim approach apparently.

The first book, Code - Charles Petzold, is only ten bucks on the Kindle right now (SOLD) and I own the other two.

I remember SICP being like 90 bucks for my hardcover copy and I'm pretty sure I bought it after reading the Joel on Software article "The Perils of Java Schools" while I was loving life as a bank IT guy so this is workable advice. It only took five years to become a "real" programmer after that. Also I sure don't remember K&R being $68[1]. (Yes I know SICP and K&R are both online for free)

[1] http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...

[2] http://www.joelonsoftware.com/articles/ThePerilsofJavaSchool...

wyclif · 2011-10-30 · Original thread
I would be far more impressed and gratified if Prentice Hall were cool enough to offer Kernighan & Ritchie's classic "C Programming Language" (2nd Edition) at 1/2 off their $57.99 sticker-shock price.

http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...

nswanberg · 2010-12-17 · Original thread
Here's the slightly modified answer I just posted there (even though it's an old question):

Back when he was still doing podcasts Joel Spolsky answered the similar question, which was partly "Does a good programmer without a CS degree really have a chance to get a job at Fogcreek?[1]" (It's near the end of the page.)

He says that for a good self-taught programmer who began with a high-level language, say PHP or Java, who comes at programming from a practical perspective, there are a few important parts of the CS curriculum the person may have missed out on, and goes on to list some books that would help fill in those gaps.

Off the top of his head he named these books in about this order:

- Structure and Interpretation of Computer Programs[2] (also free online[3])

- C Programming Language[4]

- The Unix Programming Environment[5]

- Introduction to Algorithms[6]

He said that those books covered the aspects of the CS curriculum his company needs in a good programmer, e.g. being able to create algorithms for an uncommon data structure.

Those books all have the added advantage of having exercises, and all being a very pleasant read. SICP is an introduction to many of the big ideas in CS: data structures, streams, recursion, interpretation, compilation, register machines, etc., and their implementation in Scheme (a kind of Lisp). It's a great place to start. The next two focus on implementation details like pointers and memory allocation. They are compact, powerful books. The last, Introduction to Algorithms, seems misleadingly titled, as it is fairly comprehensive and used in both undergraduate and graduate courses. If you work your way through the entire book, chapeau!

[1]: https://stackoverflow.fogbugz.com/default.asp?W29060

[2]: http://www.amazon.com/Structure-Interpretation-Computer-Prog...

[3]: http://mitpress.mit.edu/sicp/

[4]: http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...

[5]: http://www.amazon.com/Unix-Programming-Environment-Prentice-...

[6]: http://www.amazon.com/Introduction-Algorithms-Third-Thomas-C...

markerdmann · 2009-10-24 · Original thread
The classic C book is The C Programming Language by Kernighan and Ritchie (http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...).
jonke · 2009-05-07 · Original thread
This is like a never ending issue. One way to start the path to a better practice of C is to read http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp... after you finished http://www.amazon.com/Programming-Language-Prentice-Hall-Sof...
tumult · 2009-04-26 · Original thread
C isn't hard, don't worry! It's actually a fairly simple language. But it's medium/low-level and there is a lot of power within its simplicity. Fast to learn, but a long time to master, as one might say.

I don't know what people are using to learn C these days, but the standard has always been the white book http://www.amazon.com/Programming-Language-Prentice-Hall-Sof...

You will find yourself spending more time thinking about programming concepts rather than dealing with C syntax, since it's pretty concise. I don't know how difficult it is to learn about pointers if you have already been programming for a while but haven't had to use references directly, but it's very important to learn. C does not do too much for you on its own, so handling references yourself is an important skill. It will also help you understand how higher level languages and concepts work.

If you are working through it and find that you're enjoying yourself, congratulations, you're a programmer :] Then it's time to pick up the 1st volume of Knuth and start working through that.

Fresh book recommendations delivered straight to your inbox every Thursday.