40
submitted 3 weeks ago* (last edited 3 weeks ago) by hellfire103@lemmy.ca to c/programming@programming.dev

I have always had a great deal of respect for C, and I would like to start writing in it. However, while I am skilled in other languages, I basically don't know any C off the top of my head.

I find that I learn better and faster by attempting projects, rather than working through a book ir taking a class. For example, to learn Perl, I am working on a basic disk image writer that's coming along nicely.

So, what do you think might be a good idea for my first C project?

EDIT: Zig is also something I'm interested in learning. Same question, different language.

you are viewing a single comment's thread
view the rest of the comments
[-] Camille@lemmy.ml 11 points 3 weeks ago

Back when I was a student, we had to implement the following projects to validate and I think they are a really nice set of training projects for C (memory management, handling your own types, algorithms and off-by-one traps):

  • a basic implementation of diff
  • a fully functional hashmap (subproject of diff actually)

I personally wrote the followings too:

  • a program to compress/decompress archives using only the LZ77 algorithm
  • math expression evaluator (i.e. a basic interpreter)
  • a basic garbage collector (mark&sweep, mark&copy, whatever grinds your gears)

If you are already a competent developer in other languages, these should be reasonable projects. The difficulty lies in doing them in C. For the hashmap, the evaluator and the archiver, you have to correctly manage your data and memory. this makes them excellent projects for learning what makes C... C. For the garbage collector... well... you are the memory manager. Basic GC algorithms are easy to understand but what you want to learn here is the actual management of the memory. See it as a more advanced project if you want to really grok dirty C.

Most importantly: have fun :)

[-] wewbull@feddit.uk 2 points 3 weeks ago

The compression one is a great learning project IMHO. I did it long ago as a teenager. Should get them playing with File IO, iterating over buffers to create new buffers, managing some slightly more advanced data structures like stacks.

And testing it is fairly straight forward. Whatever you compress should come back when you decompress.

this post was submitted on 17 Dec 2025
40 points (100.0% liked)

Programming

24343 readers
318 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS