A classic Hangman word-guessing game for the terminal, written in C.
Guess letters to reveal the hidden word before the stick figure is fully drawn. Each wrong guess adds another body part — six mistakes and it's game over.
- 4 categories — Animals, Foods, Technology, Nature (60+ words total)
- ASCII art gallows — 7-stage progressive drawing (6 mistakes + game over)
- Color-coded output — green for correct guesses, red for wrong ones
- Score tracking — win/loss tally across multiple rounds
- Input validation — rejects non-letters and duplicate guesses
- Portable C99 — compiles on Linux, macOS, WSL, and any POSIX system
gcc -o hangman hangman.c
./hangmanOr use the Makefile:
make
./hangman- Run
./hangman - Choose Play from the menu
- A hidden word appears as underscores (
_ _ _ _) - Type one letter at a time and press Enter
- Correct letters are revealed in green
- Wrong letters add a body part to the gallows
- Win by guessing the full word — lose after 6 mistakes
- A C compiler (
gcc,clang, ortcc) make(optional)
make clean
make
./hangmanhangman-c/
├── hangman.c # Main game source
├── Makefile # Build automation
├── README.md # This file
└── LICENSE # MIT License
MIT — do whatever you like with it.
