A simple C program, which parses a given file and counts the words it contains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Joshua Westerheide 878d9d742d
fix(make): clean target does not remove words_bt bin
2 years ago
data feat: add test data 2 years ago
include refactor: drop wl_create function in favor of wl_push_word 2 years ago
src feat: improve both implementations 2 years ago
.gitignore feat: implement C++ version 2 years ago
Makefile fix(make): clean target does not remove words_bt bin 2 years ago
README.md feat: implement C++ version 2 years ago

README.md

c-words

A simple C program, which parses a given file and counts the words it contains.

Prerequisites

  • make
  • clang (any other compiler might also work, though not tested)

Usage

First you need to build the project with make:

$ make

Synopsis

words <file>, where:

  • words is the executable,
  • <file> is a path to a file

There's also a binary words_bt which uses a binary tree implementation instead of a linked list.

E.g.:

$ ./words data/aaa.txt 
Words in this list (10):
* "a": 2
* "aa": 4
* "aaa": 4

C++

There is also a C++ version (see main.cpp) which you can build with:

make cpp

Usage is the same like for the C version.