descriptionresponses to exercises from K&R C (second edition)
ownercopyleftie@protonmail.com
last changeFri, 23 Feb 2018 21:13:42 +0000 (23 16:13 -0500)
content tags
add:
README.md

copyleftie's K&R

I'm working through the exercises in the second edition of K&R C (K&R2e). I'll be blogging my way through each chapter of the book as I complete it.

repository structure

/copyleftie-krc
        |- LICENSE
        |- README.md
        |- chXX/
        |-      |- exXX-XX.{c,md}

The responses are contained in folders ch01, ch02, and so on, and the responses themselves are normally named ex${chapter_number}-${exercise_number}.c, with occasional exceptions for written responses (*.md), variants (ex*-${variant_name}.c), or (rarely) outright omissions (like exercise 1-1).

(where are the files?...)

Click tree in the above links.

style

The code in this repository arbitrarily adopts OpenBSD's variant of Kernel Normal Form (KNF), even where that style explicitly contradicts K&R2e's recommendations. This is an exercise in "pick[ing] a style and stick[ing] with it", as recommended by the book itself.

tcc

C files in this repository begin with a tcc shebang and are executable. tcc compiles fast enough to make C usable as a scripting language. I'm not sure I'd recommend using C for such a purpose, but executable .cs are very convenient for testing small programs like these ones.

bugs

I would appreciate bug reports if you notice mistakes or have any suggestions.

Deviations from OpenBSD's KNF should be considered bugs.

shortlog
2018-02-23 copyleftieRemove mkc.sh; change README.md to reflect thismaster
2018-02-17 copyleftieExercise 1-22: adjust comments
2018-02-15 copyleftieExercise 1-22: Move exlanatory comments to main() comment
2018-02-14 copyleftieExercise 1-23: flatten control structure
2018-02-14 copyleftieExercise 1-22: drive the loop with sequential motivated...
2018-02-14 copyleftieExercise 1-22: separate prints, state-changes; flatten...
2018-02-14 copyleftiemkc.sh: make usage test generic
2018-02-14 copyleftieExercise 1-22: tweak description
2018-02-14 copyleftiestyle bugfix (current chapter features only)
2018-02-14 copyleftieExercise 1-22: submit acceptable solution
2018-02-14 copyleftieExercise 1-22: corrected with DRY (but actually simpler...
2018-02-14 copyleftieExercise 1-22: offer naive solution (wrap at LINEWRAP)
2018-02-13 copyleftieMerge branch 'master' of ssh://repo.or.cz/copyleftie...
2018-02-13 copyleftieExercise 1-22: (STILL INCORRECT) restructure for clarity
2018-02-12 copyleftiestyle bugfix (KNF)
2018-02-12 copyleftiestyle bugfix (KNF)
...
heads
6 years ago master