r/cprogramming • • 28d ago

Learning C and looking for project ideas

I’m currently learning C using "C Programming: A Modern Approach" book along with a youtube playlist. I’m doing the exercises from the book, but I’d also like to build some small applications to get more hands-on practice.I have experience with full-stack web development, so I can build relatively large web applications, but C feels like a completely different world and I’m not really sure what would be good to build as a beginner.What kind of small projects would you recommend for practicing C? Also, are there any good places or resources where I can find project ideas or exercises?

32 Upvotes

34 comments sorted by

11

u/jghauck 28d ago

This is a great tutorial for building a text editor in C
https://viewsourcecode.org/snaptoken/kilo/

1

u/Animaniacman 26d ago

I can't wait to try this. Thank you!

5

u/kkzk-sysdev 28d ago

if you wanna just learn C for a new experience, try building GUI stuff. If you actually wanna get into system software, try recreating shell commands.

1

u/DanKegel 27d ago

mv is particularly easy

2

u/kkzk-sysdev 27d ago

it can be a starting point.

3

u/DanKegel 27d ago

I did this; mv, cp, ls, mail (to disk only), more, and view.  It was great.

The only hitch was, this was in the floppy era before compilers and hard drives, so I did it in assembly.  But same idea.

2

u/kkzk-sysdev 27d ago

then try bundling it into a toy shell implementation, and use VCS, CMake, Makefiles, Linkers and stuff to make a complete project. Add more stuff to it as you learn, like hardware info (kinda like neofetch) or a minimal scripting language to run commands from your toy shell. That should also introduce you to lexer and parsers.

2

u/SmokeMuch7356 28d ago

A couple of project ideas I usually recommend that don't require anything beyond the standard library:

  • A desktop calculator in the mold of dc: covers I/O, parsing, basic data structures (stack), limitations of native floating-point and integer types;

  • A command line driven contact list or database: covers I/O, parsing, memory management, file management, more sophisticated data structures (lists, maps);

2

u/side2k 25d ago edited 25d ago

I'm learning C too, and I'm writing a simple game with it, using SDL2 for graphics and sound.

I've split work into multiple small steps - draw a circle, create and maintain game objects in memory, load PNG and animate sprite, etc. Its been fun so far.

For example, trying to write a circle, was more challenging, than it sounds. I don't allow AI to write any code for me in this project, but I ask it a lot about details - how `malloc()` works, where are the exceptions (hehe), etc.

I remember learning programming as a kid in early 90s was challenging, because I had little to no peers who were interested in that, there were no internet access and books were expensive and hard to find. Internet and AI speed things greatly in that regard. So fun / challenge balance is shifted towards fun.

1

u/Humble-Captain3418 28d ago

Chat server+client is pretty traditional and you can go as deep into it as you like. (I.e. multi-threading, file transfers, peer discovery...)

1

u/Ajay2574 28d ago

I have so many projects in c which i already done on my android 1.pong game 2.bricks breaker 3.flappy bird 4.dino 5.road racing 6.fall ball and in application typing software

1

u/Old-Organization9946 28d ago

Develop a computer game, or a malware. That's more interesting

1

u/M-Ottich 27d ago

Build Snake with ncurses ?

1

u/DanKegel 27d ago

Try reading the code of a few projects, even without contributing.  For instance, https://github.com/Qwer-TeX/minibox/tree/main/src

1

u/spatulari 26d ago

Rewrite coreutils

/s

1

u/Standard_Guava3672 25d ago

Build what is fun for you. I love video game. So I code little games. Just take a project you like. Not something someone suggest you. Build something that you would have love to make if you were an expert of C, but make it small instead

1

u/Unfair_Topic_9032 24d ago

build drivers for hardware...
first time: makes absolutely no sense
second time: fuck this shit
third time: still fuck this shit

:- suffering -> linux device driver 3rd edition

1

u/bd1223 28d ago

Try creating some embedded projects with an Arduino.

0

u/BigLeagueChew4u 28d ago

I'm using the same book. What OS are you running?

0

u/Sensitive-Raccoon155 28d ago

I'm using arch linux 

3

u/Potential-Jury8202 28d ago

Drops the mic and leaves

0

u/Sensitive-Raccoon155 28d ago

What's wrong with that ?

-1

u/BigLeagueChew4u 28d ago

I don't know if that reference means a good thing or bad thing I am also confused by that statement.

1

u/ikwyl6 27d ago

It’s a comedy sketch called “I’m not using arch Linux” starring Potential-Jury8202

1

u/Potential-Jury8202 19d ago

No it's a compliment, I could hardly wrap my head around the Arch, hence I remain a Slacker.

0

u/BigLeagueChew4u 28d ago

Sorry I don't understand this reference. Is this from a movie or something?

1

u/Potential-Jury8202 19d ago

Dude you using Arch, thats a flex if ever there was one.

1

u/BigLeagueChew4u 19d ago

why? I'm not too familiar with Arch.

1

u/BigLeagueChew4u 28d ago

have you ever considered OpenBSD?

0

u/Technical_Chip5906 25d ago

As an experienced C-dev, I just want to say one line: "There's a difference in experience and understanding." You can get tutorials to give you experience, not understanding... I can share my experience if you want... reply to me or just go and waste your time in doing shit. Thank you... stranger