Age | Commit message (Collapse) | Author | Files | Lines |
|
Also of note is the length that the program reports includes the newline
character at the end. This has been clarified in a comment. The exercise
text does not specify whether to include newlines as part of the length,
so it was left alone.
Removed the contributor notice, since contributor acknowledgements are
centralized.
|
|
This marks the end of chapter 5. Admittedly, the solution for 5-20 is
terrible, but it does what it's supposed to do. I'm just excited to move
onto chapter 6 and start learning structures!
|
|
|
|
This exercise was a real pain in the ass. The original use of
getch() and ungetch() was inferior to a line-based approach. It
really doesn't seem like the way a parser should be built, but
it taught me a little about the order of recursion. I'm convinced
that a debugger is necessary if you want to build a good parser.
This implementation doesn't recurse in a natural way, or even
enough to stack data type prefixes. Hopefully by the time I get to
5-20 I'll have enough ideas to implement something that *does*
recurse well.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This exercise was somewhat irritating until I caved and used the code in
section 5.6 like the exercise suggested. The solution is not what I
think is clean, but given that [mc]*alloc haven't been covered yet, it's
probably the best one can muster.
Once I used the code in ยง5.6, the program fell into place. Still, it was
a neat exercise.
|
|
|
|
This one was pretty rough. At first I wanted to include a bunch of
error-catching and "smart" stuff. When I took a second look at it and
realized `itoa` returns 0 on a string, things became a bit easier. I
may have been able to outsource a few things to a function or two, but
overall I think it worked out.
|
|
|
|
|
|
This exercise was fun and taught me a bit about initializing arrays and
working with pointers.
|
|
|
|
|
|
This exercise was not very fun or interesting. While I somewhat enjoyed
learning to use pointers, this was a bunch of busywork. It felt like
homework, and that's terrible. It's the first exercise I've outright
disliked. If you're writing a programming book, *don't* make exercises
like this one!
|
|
This exercise seemed like it was designed to "pull it all together"
with things learned in the previous few pages. Not much new in terms
of techniques, but more a test to see how you could blend everything
together.
|
|
Detailed answers below the question will only occur now if I cannot
explain myself well enough in code and nearby comments. I'm looking
to learn how to write better comments so there's less need for prose.
|
|
|
|
|
|
|