Very appreciative for the gentle encouragement of @PHolder to embark on the Advent of Code Challenge. I complete the first day of challenges using C.

One thing I was wondering is ok to post solutions to the challenges or no?

TIL:
- IBM has easy to understand C documentation that's less opaque than the Linux documentation for me. Example: ibm.com/docs/en/i/7.4?topic=fu
- sorting an array is not that easy. the function I used was qsort() and you have to implement a comparator. I adapted the comparator from here: en.cppreference.com/w/c/algori. The only difference is I used uint64_t for everything(not sure if it was the best choice but it had all the room I needed).
- To read a bunch of numbers from a file I couldn't get fscanf) to work well because it skipped over blank lines I read in as uint64_t so I couldn't figure out where each set of numbers ended. I had better luck with a combo of fgets() and stroull().

I actually really couldn't believe I finished it. The satisfaction of eventually getting something working in C is real!

@derickflorian @PHolder Definitely ok to post your AoC solution on reddit: reddit.com/r/adventofcode/

Pay attention to the formatting conventions.

Each day will have a megathread for solutions that opens once the leaderboard is filled.

It's also a great place to get hints!

Follow

@leo @PHolder Thank you, Leo! I will check it out after I finish todays challenge!

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.