An Iterator implement in C lang.
This project was built on Windows WSL, so you'll need:
- a C compiler (
gcc) - the
makeprogram to run Makefile - the clang-format program (not required at all)
git(for cloning)
Note
Almost all of these tools are OS independent, but they can differ running on UNIX like or Windows machine.
How to use this project:
- clone it to your machine.
git clone https://github.com/nasccped/citer-example && cd citer-example- build with make command:
make build
# Makefile doesn't work well in Windows OS, consider using the following command
mkdir out; gcc (Get-ChildItem -Recurse -Path src -Filter *.c | ForEach-Object { $_.FullName }) -o out/main.exe- run it with the binary path:
# expected bin path after running `make build`.
./out/main.exe --helpNote
make run no longer works since the program expect argc to be
greater than 1.
A basic run guide:
<BIN_PATH> --help: prints the project description<BIN_PATH> <1..>: runs the project part
Any other way of use isn't supported. The program will print an
usage tip and quit with exit code 1.
A few lessons are passed along the way.
- constructor & destructor: how to create a new
CIteratorpointer - set and create from: how to set new data into
CIterator+ how create from the data itself - cursor move: how to move the cursor within an iterator queue
- getters: using
CIteratorfunctions interface instead of manually field access.