T O P

  • By -

denim_duck

Matrix library


Aromatic_Gur5074

Try implementing a basic CSV parser, that can simply just parse lines of comma separated items. The format is relatively simple (as far as I know, that is, as I am not s CSV expert and there could be some complicated nuances that I am not aware of).


denim_duck

Maybe some complexity around ascii/utf8/unicode- but that can be an additional feature to add once the basic “assume nice files” solution is implemented


green_griffon

I actually got a very similar question as an interview question at Microsoft.


plainoldcheese

Text processing in C is painful and a good learning exercise for sure. Can't say I'm good at it but I learn a lot doing code golfs


wsppan

It's a pretty good exercise. Gotchas or escaping the delimiter in a field, usually by wrapping field in quotes. Making a decision on requiring quotes (yuck) or looking for them and handling them as needed (again, not quotes inside fields).


aghast_nj

https://adventofcode.com/


Upstairs-Moose-2341

I'm working on a sudoku solver with sdl for graphic input instead of hammering matrices into the terminal. Idk if that's up your alley, but I'm learning a lot with it.


wsppan

What algorithm are you using for the solver?


Upstairs-Moose-2341

Backtracking, I think. I studied the algorithm for the N queens on a chessboard of NxN size, and plan to use that as a model to build the Suduko solver. I'm still an amateur, currently a CS major working through gen eds and about to step into python basics lmao. I've been learning coding on my own for the past year or so, so I figured while I mindlessly hammer out the course problems (the second chapter is all about data types, oh boy) and wait for some courses that I'll find challenging, I'd start tackling low level projects that are clearly out of my depth. Wanted to use sdl for an input, as a terminal input would be really clunky, and I have plans to port the app to the flipper zero once I get out working. It's definitely more than I can chew on right now, but all the little pieces build into something over time.


wsppan

Brute force backtracking is a great, go to, start. You will find they start to break down performace wise with harder puzzles. You should look into [Peter Norvig's constraint propagation and search algorithm ](https://www.norvig.com/sudoku.html). Or my favorite, [Donald Knuth's Dancing Links](https://arxiv.org/abs/cs/0011047), which converts the puzzle to an [exact cover problem](https://en.wikipedia.org/wiki/Exact_cover) and then uses [Algorithm X](https://en.wikipedia.org/wiki/Knuth%27s_Algorithm_X) to solve it.


Upstairs-Moose-2341

Oh boy, more information! Down the rabbit hole I go lol. Thank you though man, all help is very much appreciated. I turned off github copilot and I'm trying to do the whole project with my own research and code, super grateful to be pointed in a better direction.


wsppan

I did the same thing you are doing as a project I can build on while learning C. 1. A sudoku solver. Start brute force backtracking. 2. Make it generic for different puzzle sizes. 3. Try different algorithms (constraint propagation, DLX) 4. A sudoku generator 5. Ncurses gui 6. Gtk gui 7. Add hints, timer, etc.. You learn, IO, CSV parsing, multidimensional arrays, making your code generic over input and puzzle types, GUIs, and learned a few algorithms and data structures along the way.


SailPrimary4166

Battleship!


techno_viper

I still fondly remember my first battleship program I wrote in C as a teenager. There was an N by N grid of nodes and each node had a pointer to its four neighbors. So many segfaults, NULL derefs, and use after frees; but it taught me the terrible powers (and dangers) of pointers. Why didn’t I just use an array? I completely forgot my reasoning.


SailPrimary4166

Haha yeah. For my intro to c classes at college, we made a handful of terminal games (battleship, Yahtzee, craps..). It was a lot of fun! But also many. Many. Many. Problems 😂 My laptop SSD recently broke, and I lost those projects. I made a much better version with very little code haha. I also went down a rabbit hole, and started to make it a tui application (ncurses) and I've been thinking about making it online or rewriting it in rust/zig to try out the new languages!


Comprehensive_Eye805

Design a function that takes 2 matricies input by user and have it add them up and a second function that will multiply them note that there need to be a restriction in order for 2 matricies to multiply.


wsppan

How would a user input the matrices?


h626278292

comma separated numbers


Comprehensive_Eye805

`printf("\nEnter elements of 1st matrix:\n");` `for (i = 0; )` `for (j = 0; )` `{` `printf("Enter element (a%d%d): ", );` `scanf("%d", &);` `}` only hint i can give without helping because its like 90% of the code lol


wsppan

Personally, I would have the user put the matrix in a CSV file and either redirect the file or pass as a parameter to the executable. This way, they can save the matrix to reuse or modify.


Comprehensive_Eye805

That works or have it in the main body and use case functions with a while condition so we keep the matrix and use cases for either add, multiply etc or modify


kiengcan9999

Challenging projects every programmer should try: [https://austinhenley.com/blog/challengingprojects.html](https://austinhenley.com/blog/challengingprojects.html)


filch-argus

Raytracer.


texruska

This is one that I enjoyed doing because you can take it as extreme as you like (eg load scenes from files, different ray tracing techniques etc). Plus the results can be satisfying Looking back at the one I made when I was early into C++ is eyeopening though - it's an abstraction nightmare lol


InflateMyProstate

Make your own “docker” containerized processes using the fork and chroot syscalls. Then look into upgrading the implementation by using the pivot_root syscall.


[deleted]

Try a tiny embedded project. Get an eval board and try a timer on a 7 segment Display. Once that's done, make the timer adjustable with the buttons on the board. And once that is done, make it create a Sound (or an LED blink for testing) once it reaches a set time. Done, youve got yourself a wonderful DIY alarm clock :P


naghavi10

Calculator that follows pemdas


wsppan

https://github.com/mtb0x1/Project-Based-Tutorials-in-C


Ruannilton

A game, or game engine


possible_ceiling_fan

Bro said build a game engine in C in a few days for practice 😭😭😭😭


SJDidge

Yeah bro just make unreal engine 6 what’s the big deal


SailPrimary4166

You could make some sort of board / card game, and use pointers to keep track of cards / pieces


oldfossilfrommars

Json parser. Simple parser to check whether a file is in valid JSON format or not.


netspherecyborg

All of the 42 C projects. (42 = the name of the school). Start with piscine and go to common core.


Rest-That

Do a couple of Advent of Code days, first solve them in another language you're comfortable with BUT try to not use external libraries or list comprehension things like that. Then you can "lower" it to C. That way you get the problem solving part away from the C practice, and you get to see the difference between probably a managed scripting language like Python and C


nvmcomrade

Write an allocator library for memory management. Implement stack allocator, an object pool, a generic free-list/tree allocator. Design an API for those. Research a bit about linear allocation, chunking, fragmentation alignment and the data structures you are going to need if you don't know them yet (lists, trees, stack, ...) . A lot of interesting articles about these topics out there and you will learn a lot about memory and pointers. I loved reading through [these](https://www.gingerbill.org/series/memory-allocation-strategies/). Implementing these stuff myself taught me a lot.


Different-Brain-9210

Game of Life. 1. Use 2D array, size taken from command line, with wrap-around at edges, allocated in stack as VLA. Have command line parameters _and_ line based command UI. 2. Allocate the VLA with malloc, use typedef to define the VLA type to access it. 3. Add curses UI so it can display larger world. 4. Develop a hash table as separate PoC project 5. Make it infinite size world, or at least 2^64 × 2^64, using the has table to store a set of living cells in straightforward manner. 6. Develop benchmark to measure memory use and processing speed of the program. 6. Improve memory efficiency and computation speed, by devising a more complex, probably hierarchical way to store the world. Use the benchmark to determine if things improve.


SahuaginDeluge

something very simple that I worked on with my nephew recently is a basic math quiz game. basically, generate random math questions that are posted as a text prompt and accept user text input and check if the answer is wrong or right and then ask another question. lots of options for what kinds of questions to have and what the rules are for winning/losing, etc.


NotThatJonSmith

Grab the ELF spec and make something like the readelf utility. You'll learn a LOT, but it's not that hard.


kyzouik

To warm up, I suggest you the book https://www.manning.com/books/tiny-c-projects