Live data from Hacker News

Ask HN: Learn C in 2023?

news.ycombinator.com

11–20 of 220 posts

Re: Ask HN: Learn C in 2023?

#13
post #10

I suggest downloading and playing with Raylib[1]. It's written in C, not C++, and is a library for video games, but it can be used to produce apps too. It has a ton of examples for you to review and modify as you learn, and it is cross platform. There are even bindings to other languages if you decide to leave C and use your favorite language. It's a one-click download and setup. Couldn't be easier and more fun! [1]…

SDL or Raylib are very good to quickly write interactive programs or simply play around with the samples.

Re: Ask HN: Learn C in 2023?

#14
Write a CHIP-8 emulator in C!

In my opinion it’s a perfect project because:

- it is a good size. You can be done in 10-20 hours, or longer if that’s your pace (have fun!)

- a lot of examples and community support.

- you have a whole project without any overwhelming complexities: you’re just taking inputs, reading some data, running it through a switch statement, writing data, writing to a screen, then repeating.

- you have lots of “test code” aka games.

- it mostly lacks tedium: you’re not repeating ideas too often

- it’s fun!

Re: Ask HN: Learn C in 2023?

#15
If you've learned Rust then you've learned a lot about the importance of ownership and lifetimes, something C will never teach you directly. It will only punish you for failing to understand.

Re: Ask HN: Learn C in 2023?

#16
I'm a C# guy who learnt C over the past 2 years. It absolutely made me a better programmer. I learnt by going through K&R first and then Expert C programming by Peter van der Linden. I also went through OS books, books that talk about the machines like Understanding the machine. I program in many high level languages. The main difference I felt when learning C is, I felt like I needed to learn how the machine actually works (what happens when we run a program) to really appreciate C. I continue to pursue this learning, these days I'm looking into embedded stuff.

Also look at C programs. I study old, small unix programs like "more".

I must also say that I see people asking about learning C on sites like Stack Overflow and getting discouraged saying that it's outdated and all. These people are doing a great disservice.

Re: Ask HN: Learn C in 2023?

#17
I like firearms as an analogy here.

Rust is like a modern rifle, unloaded, with six safeties and three locked triggers in a gun safe. The ammunition will harmlessly self-destruct if you don’t focus properly before firing.

C is sort of like Rust except the rifle is on the couch, loaded, one in the chamber, all the safeties are off, the numerous open triggers are held by RNGs, and the business end is pointed right at your most prized possession.

It is fun, in a way. Use it in an environment that you don’t care too much about.

Re: Ask HN: Learn C in 2023?

#18
Modern C by Jens Gustedt is quite good. This video gives a good overview of some modern patterns in C:

https://www.youtube.com/watch?v=QpAhX-gsHMs

I think the best thing you can do is go find a unit testing library you like the look of, maybe some tools for address/leak sanitization, and spend a good amount of time learning CMake and creating a build/project workflow you're happy with. Coming from Rust you've got great tooling and good guardrails in place to keep you on the happy path, I think getting into that groove early in C where you can run experiments and break things in a sane environment is important.

Re: Ask HN: Learn C in 2023?

#19
The language is only part of it. In my opinion, you would learn even more about C by consuming well-known libraries written in C and trying to do something useful with it and complementing that with some books, etc rather than just learning the syntax and semantics of C.

There are tons of useful/fun things you could do with C. Write some desktop apps with GTK, a web server with Mongoose (https://mongoose.ws), etc.

Post reply on HN