A collection of practice projects created while learning C programming and systems programming.
| Project | What I Learned | Difficulty | Description |
|---|---|---|---|
| mycp | File handling, recursion | ⭐⭐ | Implementation of cp command |
| stack-calculator | Stack, algorithms | ⭐⭐⭐ | Calculator with parentheses support |
| json-parser | Parsing, memory management | ⭐⭐⭐⭐ | JSON parser and value extractor |
| mini-bash-like-shell | Processes, pipes | ⭐⭐⭐⭐ | Simple shell implementation |
| socket-server | Network programming | ⭐⭐⭐⭐⭐ | Multi-client chat server |
- File Operations: Low-level functions like open, read, write
- Processes: Fork child processes and exec other programs
- Pipes: Connect programs to exchange data
- Networking: Create servers and manage clients with sockets
- Stack: LIFO structure (used in calculator)
- String Parsing: Breaking text into meaningful tokens
- Trees: Storing JSON data in tree structures
- Pointers: Double pointers, function pointers, etc.
- Memory Management: Proper use of malloc/free
- Structures: Creating complex data structures
- Modularization: Organizing code into .h and .c files
- Linux or macOS (or WSL)
- gcc compiler
- make
# Run make in each directory
cd json-parser && make && cd ..
cd mini-bash-like-shell && make && cd ..
cd mycp && make && cd ..
cd socket-server && make && cd ..
cd stack-calculator && make && cd ..# 1. File copy tool test
echo "Hello World" > test.txt
./mycp/bin/mycp test.txt backup.txt
# 2. Calculator test
echo "2 + 3 * 4" | ./stack-calculator/bin/calc
# 3. JSON parser test
echo '{"name": "test", "value": 42}' > test.json
./json-parser/bin/json-parser parse test.json
# 4. Shell test
./mini-bash-like-shell/bin/minishell
# In shell: echo "hello" | cat
# 5. Socket server test
./socket-server/bin/socket-server 8080 &
telnet localhost 80801. mycp - cp Command Implementation
./bin/mycp source.txt dest.txt # Copy file
./bin/mycp source_dir/ dest_dir/ # Copy directoryLearned: File I/O, recursive directory traversal
2. stack-calculator - Calculator
./bin/calc
enter the expression: ( 2 + 3 ) * 4
result: 20Learned: Stack data structure, expression evaluation algorithms
3. json-parser - JSON Parser
./bin/json-parser parse data.json # Parse JSON
./bin/json-parser get data.json "user.name" # Extract specific valueLearned: String parsing, tree structures, memory management
4. mini-bash-like-shell - Shell Implementation
./bin/minishell
$ ls | grep txt > results.txt
$ cd /tmp && pwd
$ exitLearned: Process creation, pipes, redirection
5. socket-server - Chat Server
./bin/socket-server 8080
# When client connects:
/nick Alice
Hello everyone!Learned: Network programming, handling multiple clients concurrently
All projects follow a similar structure:
project/
├── src/ # .c source files
├── include/ # .h header files
├── build/ # Compiled .o object files
├── bin/ # Final executables
├── Makefile # Build configuration
└── README.md # Documentation
make # Compile
make clean # Clean build filesUseful learning resources:
- Learn C Programming - Interactive C tutorial
- C Programming Tutorial - Comprehensive C guide
- Beej's Guide to Network Programming - Socket programming made easy
- The Linux Programming Interface - Systems programming examples
- GeeksforGeeks C Programming - Practice problems and concepts
- Started from C basics and gradually tackled more challenging projects
- Memory management was the most difficult part; pointers are still confusing
- Network programming turned out to be more interesting than expected