Clings is a lightweight, interactive playground for learning C programming.
It provides small, testable exercises and an interactive Bash-based environment — similar to Rustlings, but for C.
Clings is designed to make learning C more engaging and practical.
Each exercise focuses on a specific programming concept, and you can check, reset, or get hints interactively.
💡 Think of it as your terminal-based C tutor!
CLINGS/
├── exercises/ # C source files (one per exercise)
│ ├── ex01_hello.c
│ ├── ex02_greeting.c
│ ├── ex03_sum.c
│ ├── ex04_calculator.c
│ └── ex05_temperature.c
│
├── tests/ # Shell scripts to test each exercise
│ ├── test_ex01.sh
│ ├── test_ex02.sh
│ ├── test_ex03.sh
│ ├── test_ex04.sh
│ └── test_ex05.sh
│
├── run.sh # Interactive exercise runner
└── README.md # Project documentation
git clone https://github.com/<your-username>/clings.git
cd clingschmod +x run.shYou’ll need:
- GCC — for compiling C files
- Bash — for running the interactive interface
- (Optional) Git — for resetting exercises
Verify your setup:
gcc --version
bash --version
git --versionStart learning by running:
bash run.shYou’ll see something like this:
Progress: [#########>----------------------------] 2/5
Current exercise: exercises/ex02_greeting.c
h:hint / l:list / c:check / n:next / p:prev / x:reset / q:quit
| Key | Action | Description |
|---|---|---|
| h | hint | Show the “Goal” comment from the current C file |
| l | list | Display all available exercises |
| c | check | Compile and test the current exercise |
| n | next | Go to the next exercise |
| p | prev | Go to the previous exercise |
| x | reset | Reset the exercise file to its original Git version |
| q | quit | Exit the program |
-
Launch the tool:
bash run.sh
-
Press h to get a hint:
💡 Hint for exercises/ex03_sum.c Goal: Write a program that takes two integers and prints their sum. -
Edit
exercises/ex03_sum.cusing your favorite editor:nano exercises/ex03_sum.c
-
When done, press c to check your solution:
✅ ex03_sum.c passed all tests! -
Move to the next exercise with n and keep practicing!
Each file inside tests/ is a Bash test script corresponding to one exercise.
It automatically:
- Compiles the
.cfile usinggcc - Runs it with predefined input
- Compares the output to expected results
- Prints success/failure messages
Example:
bash tests/test_ex04.shOutput:
✅ ex04_calculator.c passed all test cases!
If something goes wrong or you want to start fresh, press x in the menu.
This runs:
git checkout -- exercises/ex03_sum.c
⚠️ Works only if your exercises are tracked in Git and committed.
- Each C file starts with a Goal: section describing the task.
- Read the hint before peeking at the solution — it’s designed to guide your thinking.
- Try modifying and re-running tests to explore C behavior.
- Run
list(press l) to see all exercises and track your progress.
| Feature | Status |
|---|---|
| Interactive Bash-based CLI | ✅ Done |
| Progress bar tracking | ✅ Done |
| Hint and reset functionality | ✅ Done |
| Colorized terminal output | 🔜 Planned |
| Difficulty levels | 🔜 Planned |
| Makefile automation | 🔜 Planned |
| CI/CD test integration (GitHub Actions) | 🔜 Planned |
To make things even easier, a simple Makefile could let you run:
make run # Start interactive menu
make test # Run all test scripts
make clean # Remove compiled binaries(You can add this feature later.)
Progress: [###########################>------------] 4/5
Current exercise: exercises/ex05_temperature.c
h:hint / l:list / c:check / n:next / p:prev / x:reset / q:quit
💡 Hint for exercises/ex05_temperature.c
Goal: Write a program that converts Celsius to Fahrenheit and vice versa.
SherMuhammad
📧 email@example.com
💻 github.com/codebysher
Feel free to fork, star ⭐, and contribute new exercises!
This project is licensed under the MIT License — see the LICENSE file for details.
You can freely use, modify, and distribute it for educational purposes.
🧠 “Practice doesn’t make perfect — consistent practice makes progress.”