Skip to content

Commit e2a1f95

Browse files
committed
minor cleanup
* main now returns the right status * added comment * added assumption about multiple occurances on the same line
1 parent d5add34 commit e2a1f95

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed
Binary file not shown.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Assumptions
1717
* Apart from ', the program removes all punctuation and unprintable characters.
1818
* That all input files are ASCII (or will be interpreted as ASCII)
1919
* That lines are limited to 1024 characters in length
20+
* That words that appear multiple times on the same line will have that line listed multiple times for that word
2021

2122
Files
2223
-----

src/main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
size.
2121
2222
where:
23-
P is the average length of a line
24-
L is the number of lines
25-
K is the number of unique words
26-
W is the average length of a word
23+
P is the average length of a line
24+
L is the number of lines
25+
K is the number of unique words
26+
W is the average length of a word
2727
*/
2828
int main(int argc, char* argv[])
2929
{
@@ -55,5 +55,5 @@ int main(int argc, char* argv[])
5555
// though we could technically just exit and let the OS deal with this
5656
// it'll free the memory for us
5757
stateDelete(state);
58-
return 0;
58+
return result;
5959
}

src/process.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "uthash.h"
77
#include "process.h"
88

9+
// the maximum number of characters we expect to be in a line
910
const unsigned int MAX_LINE_LENGTH = 1024;
1011
// these are the tokens we'll use to split words in a line
1112
// don't include "'" since it could be a contraction

0 commit comments

Comments
 (0)