Live data from Hacker News

Ask HN: Learn C in 2023?

news.ycombinator.com

1–10 of 220 posts

Ask HN: Learn C in 2023?

#1
Hello,

I always have the itch to learn C, juts because it was such an influental language and when you are digging around a lot in GNU/linux you will have contact with it one way or another.

What is the way you would suggest learning C in 2023? I am already familiar with other languages (rust..) but would like to have an introduction to the C basics and program some hands-on projects in C, so I can learn the pecularities of the language.

Re: Ask HN: Learn C in 2023?

#2
Depends on your style of learning, but most people learn best by implementing something in a new language. Here are a few examples: a Brainfuck interpreter, a raytracer, even command line tools like ls, cat, grep are good exercises. If you are into electronics C is great for embedded work - I would buy a Raspberry Pi Pico and write C programs for it.

I would also suggest to enable all warnings your compiler allow for and sanitizers if possible. You will also want to learn to use a debugger that works on your operating system.

Re: Ask HN: Learn C in 2023?

#8
https://www.learn-c.org/

If you have lots of time: https://hal.inria.fr/hal-02383654

If you can't be bothered reading a whole book: https://matt.sh/howto-c

Exercises: https://www.codestepbystep.com/problem/list/c and https://exercism.org/tracks/c

Once you have syntax and basic algorithms down well, watch this, the only 2 hour YouTube video I'll ever recommend: https://m.youtube.com/watch?v=443UNeGrFoM

Both r/cprogramming and r/C_programming are active, also full of lazy students trying to get people to do their homework. If you come by, describe your problem well with code. Say you're learning for yourself, not for school.

Together C & C++ is a good Discord if you prefer live chat: https://discord.gg/tccpp

Re: Ask HN: Learn C in 2023?

#9

maybe try some embedded development, like raspberry, light up some leds. Embedded development is fun, educational and one of the last bastions of programming where C makes sense.

ESP32 is quite nice. It is much lower level than Raspberry Pi or similar SBCs, and C really makes sense there.

It ships with pretty high-level libraries (connecting to a Wi-Fi network is ~200 lines of C code), and you'll be running on top of a small operating system (FreeRTOS). But you still have full access to hardware and all the fun of working directly with it. The dev boards are quite cheap at $3-4 per piece, and have lots of peripherals (including Wi-Fi and Bluetooth).

Have a look for ESP-WROOM-32D at aliexpress, or whatever the platform of choice in your country is. Some of the newer boards are built on RISC-V, if that's your thing.

Their SDK also has first-class Linux support (and the other two OSs, obviously).

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/

Re: Ask HN: Learn C in 2023?

#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] https://www.raylib.com/

Post reply on HN