A growing collection of small, fix-and-improve C challenges for CODE URV partners. Each challenge includes a buggy starter program and one or more reference solutions. You’re invited to submit your own solutions via pull request.
gcc(or any C11-compatible compiler)make(for the provided Makefiles)gdb(optional, for debugging)
# from a challenge solution folder, e.g.:
cd challenges/01_ScapeRoom/solutions/solution_exhaustive
# build (via Makefile)
make
# run
make run # or: ./app
# debug (rebuilds with -g -O0 and launches gdb)
make debugIf you prefer not to use make, you can compile and run directly:
gcc -std=c11 -Wall -Wextra -Wpedantic *.c -o app
./app.
├── README.md
└── challenges/
└── 01_ScapeRoom/
├── original/ # original buggy source (for the challenge)
└── solutions/
├── solution_naive/ # minimal changes to pass the challenge
└── solution_exhaustive/ # robust version with safer I/O, etc.
A small “escape room” style program with intentional bugs around input handling and branching. The goal is to fix format specifiers, reading logic, and switch-case conditions to produce a correct personalized greeting.
Original assignment (OnlineGDB):
| Part | Path | Notes |
|---|---|---|
| Challenge (original) | challenges/01_ScapeRoom/original/ |
Buggy code. Focus: safer input (fgets vs. scanf), buffer sizes, and correct switch cases. |
| Solution: naive | challenges/01_ScapeRoom/solutions/solution_naive/ |
Minimal edits to make it work while keeping the original spirit. |
| Solution: exhaustive | challenges/01_ScapeRoom/solutions/solution_exhaustive/ |
Defensive I/O helpers, boundary checks, and clearer structure suitable for teaching best practices. online solution in onlineGDB |
Contributions are welcome! You can add:
- New solutions to existing challenges (different styles, trade-offs, or teaching angles).
- New challenges (small, self-contained programs with purposeful bugs).
How to contribute
-
Fork the repository.
-
Create a branch for your change:
git checkout -b feat/my-solution-01 -
Place your work under the appropriate folder:
- New solution:
challenges/<NN_Name>/solutions/<your_solution_name>/ - New challenge:
challenges/<NN_Name>/withoriginal/and an initialsolutions/subfolder
- New solution:
-
Include a short
README.mdinside your solution with:- Build/run instructions (
make,gcc,gdbusage if relevant) - What you fixed/changed and why
- Any caveats or discussion points
- Build/run instructions (
-
Open a Pull Request. In the PR description, link the challenge and summarize your approach.
Guidelines
- Prefer C11,
-Wall -Wextra -Wpedantic. - Avoid unsafe I/O; if you use
scanf, limit widths and justify the choice. - Keep code clear and commented where it teaches a lesson (inputs, buffers, error paths).
- If you change behavior for portability (e.g., locales, Unicode), note it in your solution’s
README.md.
- 02 — TBD: input parsing and validation
- 03 — TBD: string manipulation and boundary checks
- 04 — TBD: modularization with headers and multiple source files
Have an idea for a challenge? Open an issue or draft PR with a short description and an example of the intentional bug(s).
This project is free software. Unless stated otherwise in subfolders, all content is licensed under the GNU General Public License v3.0 (GPL-3.0).
If you need a different license for your submission, include a LICENSE file in your solution folder and mention it in your solution’s README.md.