Follow

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"

@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. :)

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

Sure. I post my on a forum that supports hiding behind spoiler tags, but by the time the first hour or two has past, the hard-core coders have already gotten the top prizes and us regular folks are just plodding along. The Reddit for AoC has guidelines for the posting of code, and they follow the stats to see when all of the top 100 have be claimed.
reddit.com/r/adventofcode/
#AdventOfCode

@PHolder ok, great, thank you! That makes sense that I’m not really spoiling the competition for anyone! I will post my repo tomorrow.

@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!

@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.