Like all IDEs, Code::Blocks is effectively a front for the clang, minGW, or gcc compiler lurking somewhere under its skin. While you don’t use these command line tools directly, you can control their options and settings from within the IDE.
Continue reading
Author Archives: dgookin
Compiler Options at the Command Prompt
The traditional C compiler is cc. Its GNU replacement in the Linux world is gcc. A better option is the LLVM clang compiler. As commands typed at a prompt, you control these compilers by setting command line options or switches.
Continue reading
Find the Most Factors – Solution
The challenge for this month’s Exercise is to discover those values in the range 1 to 999 that have the highest number of factors. Never mind the math! Let C and the computer do the work for you.
Continue reading
Emulating the foreach Keyword
In last week’s Lesson, I covered how to obtain the number of elements in an array. This process is the first step to emulating the foreach keyword in the C language.
Continue reading
Find the Most Factors
If given a pad, pencil, and a factor problem years ago, I would have found doing anything else in the world more exciting. Math is not my forte, yet it remains a curiosity. Especially with The Power Of The Computer, performing math exercises is more of an interesting challenge than a mental ordeal.
Continue reading
In Search of the foreach Keyword
C has three looping keywords: do, for, and while. These keywords construct a block of statements that repeat, hopefully but not necessarily with a terminating condition. Other programming languages offer additional looping keywords, including the popular and useful foreach.
Continue reading
Harmonic Series, Divergence, and C Code
A harmonic series is a mathematical contraption that deals with cascading fractions. Like the Fibonacci series, I thought I could easily code a harmonic series in C — which I did, but not before reading up on the topic of divergence.
Continue reading
Fun With Series: Fibonacci and Harmonic
My maths grades were horrible. I understand the concepts, but failed at solutions in class because I’d make silly mistakes. Computers make mistakes only when they’re programmed to do so, which means maths are far more enjoyable for me as a coder. For example, take the Fibonacci sequence.
Continue reading
Some Weighty Conversions – Solution
This month’s Exercise is to create a program that converts weight measurements by using this format:
nnnFT
Where nnn is a value, F is the unit to convert from, and T is the unit to convert to. This problem is more of an input-parsing exercise than a straight conversion.
Continue reading
My Chicken McNuggets Solution

The Chicken McNuggets problem, presented in last week’s Lesson, shows code that outputs the highest McNuggets number from 1 to 100. This value isn’t a combination of 6, 9, or 20, the number of the pieces offered in the McDonald’s Chicken McNuggets packages.
Continue reading