|
|
8665f996e5
|
At long, panful last, a functional version of exercise 1-17. The code has contracted considerably since the intiially architected version, with replicate() and its functionality having been eliminated as unnecessary, saving numerous cycles and ~64kB of memory, advance() has been eliminated due to creating needless complexity, hindering readability, and decreasing efficiency, and recall has been eliminated because it depended on replicate, and was also unnecessary as enumerate() now contains three lines of code that completely eliminate the need for replicate() or enumerate().
|
2025-09-19 00:00:30 +00:00 |
|
|
|
848898ff11
|
WIP overbuilt solution to exercise 1-17.
|
2025-09-17 20:54:19 +00:00 |
|
|
|
2084b2ae84
|
WIP version of ex1-17-2.c that crashes during a memory safety check in store() for some reason. If I comment out the check, it spins and segfaults. Cause unknown.
|
2025-09-16 18:54:10 +00:00 |
|
|
|
df60eb6528
|
Reverted a change that erroneously removed ex1_17.c.
|
2025-09-05 18:52:32 +00:00 |
|
|
|
841097a626
|
Formatting adjustments and created initial file for exercise 1-17.
|
2025-09-05 18:49:44 +00:00 |
|
|
|
481f76699e
|
storage.txt is now created at runtime rather than being assumed to be present and empty. recall() now removes storage.txt at completion. main() now includes a check to see whether storage.txt already exists, sends an error message, and exits with code 1 if storage.txt is already present.
|
2025-09-02 21:02:47 +00:00 |
|
|
|
5ec722b2ca
|
recall() now properly closes storage.txt on completion.
|
2025-09-02 20:35:08 +00:00 |
|
|
|
e57d4717d7
|
WIP solution to exercise 1-16 using a file on disk as a storage buffer for stdin so that we can step through the input repeatedly.
|
2025-09-02 20:33:31 +00:00 |
|
|
|
87e93e98ca
|
Stub of an improved version of ex1_16 to allocate array sizes on the fly and support arbitrarily long input.
|
2025-08-28 23:32:07 +00:00 |
|
|
|
c47e378a4f
|
Skeleton of exercise 1-16; functionally a verbatim copy of the example text on page 30 of KNR C, though in reality, I have made it more readable and fixed a couple of bugs related to expanded functionality of modern C.
|
2025-08-28 21:25:07 +00:00 |
|
|
|
4ddc868da3
|
An implementation of exercise 1-15 that I spent far too long banging my head against over an issue that turned out to be me having flipped 5 and 9 in my math.
|
2025-08-27 00:13:13 +00:00 |
|
|
|
73d3fe21ac
|
Fixed a potential bug that would cause a hang on unrecognized input. Added a 39th position to both charCount and printTable for storing, enumerating, and displaying untracked characters that do not fit to a defined position in charCount.
|
2025-08-26 17:52:11 +00:00 |
|
|
|
22694dfae0
|
Added support for numbers. Removed refTable[], changed enumeration loop to check via sequential if-else statements if a character is within a given range. This was done in favor of a lookup array to improve performance.
|
2025-08-26 17:42:41 +00:00 |
|
|
|
cff9570b57
|
KNR C exercise 1-14 implementation with some really cool optimization and tricks.
|
2025-08-23 19:49:32 +00:00 |
|
|
|
207fe60c5b
|
Per suggestions and feedback from Affine, removed a loop that initialized the charCount array, since modern C allows us better ways to do this. Saved 5 instructions in the binary :3
|
2025-08-22 18:32:09 +00:00 |
|
|
|
136abce9bf
|
Cleaned up formatting. Removed an unused comparison in the for loop responsible for printing the histogram.
|
2025-08-22 18:24:08 +00:00 |
|
|
|
14730549f1
|
Push final version of ex1_13 to repo, as only the skeleton was included in the initial commit by mistake.
|
2025-08-21 11:52:11 -07:00 |
|
|
|
296d1157a0
|
Completed exercise 1-13, with a bonus version that trades an extra 4 bytes in memory for an equally miniscule perfomance gain at execution.
|
2025-08-19 17:45:32 -07:00 |
|
|
|
4b03274352
|
Skeleton prototype for exercise 1-13.
|
2025-08-19 13:58:39 -07:00 |
|
|
|
dbf602e13d
|
Implemented KNR C Exercise 1-12, reusing mostly modified code from my previous (optional) implementaiton of KNR C's example wordcounting program.
|
2025-08-16 02:14:40 +00:00 |
|
|
|
2523043172
|
Nearly direct copy of a word count program from KNR C, mimicked here only so that I could compare the size of the resulting binary once compiled to my own solution, archived as ex1_10-5.c (ex1-10.5). The resulting binary, as compiled with GCC, was 136 lines long, 2 lines shorter than my own. Challenge failed :sigh:. Good exercise, though; I'll come back to this and study why later.
|
2025-08-16 02:07:42 +00:00 |
|
|
|
313e4aaa3b
|
Added ex1_10-5.c, an implementation of an example wordcount program on pages 21/22 of KNR C, purely as an exercise to see if I could do it more efficiently than the book. This resulted in a binary that was, 138 lines long as disassembled.
|
2025-08-16 01:53:43 +00:00 |
|
|
|
d3ce211f14
|
Implemented a suggestion from Affine to replace the many if statements with a single switch and only ever call getchar at one point in the code.
|
2025-08-14 22:32:02 +00:00 |
|
|
|
43f172da21
|
Cleaned up unnecesary curly braces.
|
2025-08-14 22:07:31 +00:00 |
|
|
|
b466a300d0
|
Annotation updates.
|
2025-08-14 22:05:46 +00:00 |
|
|
|
2638922bbe
|
Untested initial version of code for visibility.
|
2025-08-14 21:54:38 +00:00 |
|
|
|
635a8300a3
|
Implemented suggestions from affine. Considerably simplified the program by removing initialization for 'a' prior to loop entry; 'a' is now declared as the initialization expression for the loop, performing a getchar at the same time and preventing a null byte from being printed as the first character (even though this was not visible to the user).
|
2025-08-14 20:02:00 +00:00 |
|
|
|
abc0ac1660
|
Rewrote while loop as a for loop to reduce overall program size.
|
2025-08-14 19:52:12 +00:00 |
|
|
|
d6f81778ef
|
Completed and improved ex1_10 using a switch function.
|
2025-08-14 19:23:28 +00:00 |
|
|
|
d3262419a8
|
Added comments to explain certain code behaviors in ex1_10.c so that they can be read and referred to later more easily. Future code should be properly annotated on initial commit.
|
2025-08-14 17:42:15 +00:00 |
|
|
|
1ac53c22b2
|
Minor change to reprint a single \ as \ instead of \.
|
2025-08-14 17:29:11 +00:00 |
|
|
|
bbf858134c
|
Initial incomplete implemenation of exercise 1-10. Current version only reprints tabs to \t and backslashes to \ rather than the intended behavior of doing that in addition to reprinting backspaces as \b. Bug is due to not capturing backspaces as input. Fix pending.
|
2025-08-14 17:27:43 +00:00 |
|
|
|
84a9263691
|
Added a solution of 1-9 developed collaboratively by both of us <3
|
2025-08-14 07:15:51 +00:00 |
|
|
|
7d26e0ffc7
|
Implementation of exercise 1-9: copying and printing input text to output, removing redundant spaces.
|
2025-08-14 06:53:38 +00:00 |
|
|
|
7be84d6b88
|
Complexted exercise 1-8; count and report number of newline, tab, and blank characters in input.
|
2025-08-13 07:16:39 +00:00 |
|
|
|
7682f93933
|
Delete dumbtest.c
Removed in favor of ex1_7.c
|
2025-08-13 05:48:26 +00:00 |
|
|
|
a36892d8be
|
Changed name of dumbtest.c to ex1_7.c to reflect what exercise was completed in this code.
|
2025-08-13 05:46:40 +00:00 |
|
|
|
9ed3796014
|
Changed 'c' to 'a' while working on other, later abaondoned changes.
|
2025-08-13 05:44:14 +00:00 |
|
|
|
191b35631c
|
Modifications and bugfix to prevent the program from returning an error code on exit.
|
2025-08-09 23:14:04 +00:00 |
|
|
|
6860b93049
|
Added dumbtest.c to demonstrate a test for the boolean value of != EOF. Numerous modifications to ex1_6-getchar.c to that end before dumbtest.c became its own project- most modifications reverted.
|
2025-08-09 23:12:19 +00:00 |
|
|
|
93d53163f8
|
sync minor code change
|
2025-08-07 23:42:52 +00:00 |
|
|
|
79b0940502
|
Implemented exercise 1-6 for additional testing and modification.
|
2025-08-07 23:25:33 +00:00 |
|
|
|
fc658ddb69
|
Bugfix for a spin caused by setting the value of fahr inside the for loop when it is now initialized at loop start.
|
2025-07-29 17:00:35 -07:00 |
|
|
|
61e32d0e22
|
Reformatted declarations for some floats to more modern standards.
|
2025-07-29 16:57:11 -07:00 |
|
|
|
f42b5d0b09
|
Re-implementation of exercise 1-2 as a for loop instead of a while loop and simplified printing and calculation into a single statement as demonstrated in section 1-3.
|
2025-07-29 15:06:59 -07:00 |
|
|
|
44dff59271
|
Implemented the objectives of Exercise 1-3 to ex1_1-tempconverter.c and then implemented the objectives of Exercises 1-3 and 1-4 to ex1_4-tempconvertercf.c.
|
2025-07-29 14:44:47 -07:00 |
|
|
|
357347ae6e
|
Add both header for the entire table, and individual headers denoting which column is which unit.
|
2025-07-29 14:17:11 -07:00 |
|
|
|
67483eaceb
|
Initial commit for KNR C exercises
|
2025-07-29 13:06:28 -07:00 |
|