Notifications

No notifications

/Phase 4

Practice & Mini-Projects

Previous

You Now Know C 🎉

You've covered the full C journey:

  • Phase 1 — syntax, types, variables, operators, control flow
  • Phase 2 — loops, arrays, strings, functions
  • Phase 3 — pointers, dynamic memory, structs, file I/O
  • Phase 4 — preprocessor, bitwise, recursion
This final topic is your launchpad: a curated set of problems and small projects that turn classroom C into real engineering muscle.

How to Practise

1. Pick a problem. Read it twice. Solve on paper first. 2. Code it. Compile with gcc -Wall -Wextra -fsanitize=address -g. 3. Test edge cases — empty input, max size, negatives, zero. 4. Refactor. Can you make it shorter? Faster? Safer? 5. Move on. Don't get stuck >45 min — read an editorial, learn, retry tomorrow.

TierWhenWhat
Warm-upsDays 1–7Easy I/O, math, strings
CoreWeeks 2–4Arrays, loops, functions, basic pointers
MemoryWeeks 4–6malloc/free, dynamic arrays, linked list
ProjectsMonth 2Calculator, todo CLI, file scanner, mini shell
AlgorithmsOngoingSorting, searching, recursion, bit tricks

On this page

Detailed Theory

Knowing the syntax is 10% of programming. The other 90% is building things and debugging them. This topic exists to push you from "I read about C" to "I write C".

Daily Habit

Pick ONE small problem per day. 30 minutes is enough. Consistency beats marathons.

> The best C programmers got there by writing many small programs, not by reading one giant book.

How to Compile Like a Pro

# Strict warnings + address sanitizer + debug info
gcc -Wall -Wextra -Wpedantic -fsanitize=address -g main.c -o main

FlagWhat it gives you
-Wall -WextraMost useful warnings — fix them all
-WpedanticStrict ISO C compliance
-fsanitize=addressCatches use-after-free, leaks, overflows at runtime
-gDebug symbols (so you can step in gdb / VS Code)
-O2Optimisations (use for release; off while debugging)

Fix every warning. Warnings are usually bugs in disguise.

Mini-Project Ideas (in order of difficulty)

Level 1 — A Few Hours Each

1. Number Guessing Game — pick a random number, prompt user, give "higher / lower" hints, count attempts. 2. Tip Calculator CLI — read bill amount and people, print per-person share with rounding. 3. Word Counter — read a file, count lines, words, characters (like Unix wc). 4. ROT13 / Caesar Cipher — encrypt/decrypt text with a shift key. 5. Temperature Converter — switch between Celsius / Fahrenheit / Kelvin.

Level 2 — A Day or Two

6. TODO List CLI — add / list / mark-done / delete tasks, persist to a text file. 7. Hangman — load random word from a file, manage guesses, draw the man. 8. Tic-Tac-Toe — 2-player on a 3×3 board, detect win/draw. 9. Phonebook — store contacts in a struct array, save/load to disk, search by name. 10. Linked List Library — implement push/pop/insert/remove/print + iterator.

Level 3 — A Week+

11. Dynamic Stack & Queue — generic, with malloc, free, grow/shrink. 12. Hash Table — with chaining; insert/get/delete in O(1) average. 13. Mini Shell — read a command line, fork/exec it, support pipes (Unix) or basic command parser (cross-platform). 14. JSON Parser — given a small JSON string, output a parsed structure. 15. Matrix Library — add/multiply/transpose/inverse; bonus: read from CSV.

Algorithm Practice Sets

TopicWhat to drillWhere
Sortingbubble, selection, merge, quicksortLeetCode 912
Searchinglinear, binary, two-pointerHackerRank Algorithms
Recursionfactorial, fib, hanoi, subsetsGfG Recursion
Bit trickspopcount, single number, power of 2LeetCode Bit Manipulation
Stringsreverse, palindrome, anagramHackerRank Strings
Linked listsreverse, detect cycle, mergeLeetCode Linked List

  • HackerRank C trackhackerrank.com/domains/c — official C problems, easy to hard.
  • HackerRank 30 Days of Code — daily mini-challenges, language-agnostic.
  • CodeChef Beginnercodechef.com/practice/beginner — short, fast wins.
  • GeeksforGeeks School — basics + small algorithm problems.
  • LeetCode Easy → Medium — once you're comfortable, switch to LeetCode for interview-style problems.
  • K&R Book Exercises — the original C exercises from "The C Programming Language" — still gold.

Debugging Toolkit

ToolPurpose
printf-debuggingQuick & dirty — print state at suspicious places
gdb / VS Code debuggerSet breakpoints, step, inspect variables
AddressSanitizer (-fsanitize=address)Catches memory bugs at runtime
valgrind --leak-check=fullFinds leaks and uninit reads
clang --analyzeStatic analysis — finds bugs without running

A Self-Test Checklist

If you can do all of these without looking, you've learned C properly:

  • [ ] Read input from scanf and validate it
  • [ ] Loop over an array and find max / min / average
  • [ ] Reverse a string in place (no helper buffer)
  • [ ] Implement strlen, strcpy, strcmp from scratch
  • [ ] Allocate a dynamic array of n ints, fill it, free it correctly
  • [ ] Implement a singly linked list with insert/delete/print
  • [ ] Read a text file line by line and process each line
  • [ ] Define a struct, pass it by pointer, modify it
  • [ ] Write a recursive solution for factorial / Fibonacci / power
  • [ ] Set, clear, toggle, and test a specific bit in a flag word

Where to Go From Here

C is the gateway to systems programming. After this you can pick:

DirectionBuild on
C++Same syntax, adds classes, templates, STL
RustModern systems language with C-like performance + memory safety
OS / KernelThe Linux kernel, embedded firmware, compilers — all C
Game devEngine code in C/C++, scripting on top
Competitive programmingC++ for speed; algorithms you learned all transfer

Final Word

> "The only way to learn a new programming language is by writing programs in it." — Kernighan & Ritchie

You've finished the C track. Now go build something you find genuinely cool. The craft is in your hands. 🛠️