aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-04-08Solve Exercise 5-15: Case-insensitive sortzlg2-1/+179
2014-03-20Solve Exercise 5-14: reverse sortzlg1-0/+152
2013-10-18Solve Exercise 5-13: tailzlg1-0/+106
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.
2013-10-13Solve Exercise 5-12: flexible `detab` and `entab`zlg2-0/+157
2013-09-26Solve Exercise 5-11: `entab` and `detab` remixed!zlg2-0/+137
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.
2013-09-24Clean up 5-10's printf() callszlg1-4/+0
2013-09-24Solve Exercise 5-10: exprzlg1-0/+107
2013-09-21Solve Exercise 5-9: day of year functions with pointerszlg1-0/+74
This exercise was fun and taught me a bit about initializing arrays and working with pointers.
2013-09-15Solve Exercise 5-8: Checking for errorszlg1-0/+83
2013-09-11Solve Exercise 5-7: Improved readlines()zlg1-0/+106
2013-09-08Solve Exercise 5-6: pointer-based functionszlg1-0/+154
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!
2013-09-03Solve Exercise 5-5: strn{cpy|cat|cmp}zlg1-0/+76
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.
2013-09-02Solve Exercise 5-4: strend()zlg1-0/+37
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.
2013-08-29Solve Exercise 5-3: pointer-powered strcat()zlg1-0/+42
2013-08-19Solve Exercise 5-2: getfloat()zlg1-0/+75
2013-08-13Solve Exercise 5-1: fixed getint()zlg2-13/+82
2013-08-08Solve Exercise 4-14: Swap Macrozlg1-0/+30
Thanks to ##c on Freenode for helping me understand what the text didn't clarify.
2013-07-23Correct Exercise 1-22's solutionzlg1-51/+64
Tabs are now handled properly and the instructions are better followed.
2013-07-22Solve Exercise 4-13: Recursive reverse()zlg1-0/+48
2013-07-15Solve Exercise 4-12: Recursive itoa()zlg1-0/+72
2013-07-03Solve Exercise 4-11: getop() without ungetch()zlg1-0/+263
2013-06-27Solve Exercise 4-10: getline()-based calculatorzlg1-0/+276
2013-06-26Solve Exercise 4-9: Pushed EOF and [un]getch()zlg1-0/+284
2013-06-24Solve Exercise 4-8: Single character bufferzlg1-0/+281
2013-06-22Solve Exercise 4-7: ungets()zlg2-2/+278
2013-06-21Solve Exercise 4-6: Variable supportzlg1-0/+272
2013-06-19Solve Exercise 4-5: adding sin(), exp(), pow()zlg1-0/+216
2013-06-19Solve Exercise 4-4: Basic stack manipulationzlg1-0/+201
2013-06-18Solve Exercise 4-3: Add modulus to RPN calculatorzlg1-0/+147
2013-05-08Solve Exercise 4-2: atof() enhancedzlg1-0/+81
2013-05-05Solve Exercise 4-1: strrindex()zlg1-0/+87
2013-04-23Add exercise descriptions and answers for ch1zlg13-51/+158
* Corrected behavior in solutions for 1-9 and 1-23
2013-04-23Solve Exercise 3-6: itoa (3 arg version)zlg1-0/+67
2013-04-20Solve Exercise 3-5: itobzlg1-0/+85
2013-04-19Solve Exercise 3-4: itoa improvedzlg1-0/+71
2013-04-18Solve Exercise 3-3: expand()zlg1-0/+82
2013-04-16Solve Exercise 3-2: escape/unescapezlg1-0/+68
2013-04-16Solve Exercise 3-1: binsearch2zlg2-1/+72
2013-04-06Solve Exercise 2-10: lower()zlg2-1/+33
Also added more information to 2-09's comments.
2013-04-06Solve Exercise 2-9: bitcount()zlg1-0/+43
2013-04-04Solve Exercise 2-8: rightrot()zlg1-0/+52
2013-04-03Solve Exercise 2-07: invert()zlg1-0/+38
2013-03-31Solve Exercise 2-6: setbits()zlg1-0/+44
2013-03-27Solve Exercise 2-5: The any() functionzlg1-0/+44
2013-03-22Solve Exercise 2-04: Squeeze v2zlg1-0/+51
2013-03-02Solve Exercise 2-3: Hex to integer converterzlg1-0/+48
This exercise was fun, and I learned a simpler way to convert them.
2013-02-28Change 2-02's solution to a while loopzlg1-11/+7
A recursive function is a bit much for something that simple.
2013-02-27Solve Exercise 2-02: No logical operatorszlg1-0/+44
The text doesn't specify which technique to use. The section outlined operator precedence, but I couldn't think of a way to check for truth in the three main expressions without logical operators. So I turned to a recursive function. It works, but I'm not sure if it's what K&R were after.
2013-02-21Shorten 2-01's codezlg1-22/+2
There's no code like no code! :)
2013-02-21Correct 2-01 solutionzlg1-4/+14
FLT_MIN and DBL_MIN refer to the lowest _positive number_ representable in floating-point form on the machine, not the lowest _negative number_. Subtracting FLT_MAX from 0 will give you the minimum.