C Program Examples - 400+ tested C programs, all 91 K&R solutions, free quizzes
byā¢
Most C tutorial sites are full of void main(), gets(), and outputs nobody ever ran. Every program I ship is compiled with gcc -Wall -Wextra at zero warnings and actually executed ā the output you read is the output I got.
Inside: 400+ C programs, all 91 K&R exercises solved, 9 topic quizzes (150+ questions) synced with a free Android app, real gdb/Valgrind/Make/CMake guides, and interview prep with tested code.
Free, no signup, 100/100 PageSpeed. Solo project since 2011, rebuilt in 2026.
Replies
honestly the zero warnings with -Wall -Wextra thing really got me, that's basically unheard of in tutorial code. ran a couple of the k&r solutions and they actually compiled clean on my machine too.
@nurullahu6yqĀ
Thank you for actually running them ā that's genuinely the best compliment this project can get. The zero-warnings rule came out of embarrassment more than discipline: the 2012 versions of these posts were full of void main() and conio.h, and once I started rebuilding I decided nothing goes live unless gcc -ansi -Wall -Wextra comes back silent and the output shown is from a real captured run. If a post ever throws a warning on your setup ā newer gcc versions do surface new ones sometimes ā tell me which one and I'll fix it within the week.
Sketches over here tend to be a wall of code with no context, so it's refreshing to see actual outputs next to each snippet. The K&R solutions being warning-free under `-Wall -Wextra` is the kind of thing I'd wish more tutorials cared about.
@maddoxmara65205Ā
Thanks Mara ā the outputs are the part I'm most stubborn about. The giveaway on old tutorial sites (including mine, in 2012) was that posts showed code but no output, because nobody had ever actually run it. Now every output block is copied from a real run of the exact code in the post ā if the program reads input, the sample session shown is a real session. It makes writing a post slower, but it means a reader can diff their result against mine and know immediately whether something's wrong on their end or mine.
Pazi
Really appreciate that every program is actually compiled and tested ā that's rare for C tutorials. Solving all 91 K&R exercises is a great resource. Congrats on launching!
@zvonimir_sabljic1Ā
Thanks Zvonimir! The 91 cover chapters 1ā7 completely ā that leaves just the final chapter (8, the UNIX system interface), which is on my list. Every solution gets the same treatment: compiled with -ansi -Wall -Wextra, run, and the real output published with it. Appreciate you stopping by on launch day ā and good luck with Pazi!