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

Remembering IBM error code books though. You'd look, you'd index, you'd eventually get to the "right" binder, and on page 1062, find that the reason for error 5078 is that "Error 5078 has occurred"

Follow

@cjcox @PHolder 😂 That is hilarious and must have been really frustrating.

The compiler error messages from gcc were actually really helpful. Hopefully I can avoid runtime errors until the 2023 advent of code challenges. :)

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.