Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

  • C For Dummies (home)
  • History
  • Series
  • Supplemental
  • Blog Miscellany

Category Archives: Lesson

Post navigation

← Older posts
Newer posts →

The 27th International Obfuscated C Code Contest

Posted on January 23, 2021 by dgookin
Reply

The results of the 27th International Obfuscated C Code Contest were announced earlier this month. The code is amazing. It runs. It’s horrifyingly cryptic.
Continue reading →

Posted in Lesson | Leave a reply

Compiler Options in Code::Blocks

Posted on January 16, 2021 by dgookin
Reply

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 →

Posted in Lesson | Leave a reply

Compiler Options at the Command Prompt

Posted on January 9, 2021 by dgookin
3

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 →

Posted in Lesson | 3 Replies

Emulating the foreach Keyword

Posted on January 2, 2021 by dgookin
Reply

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 →

Posted in Lesson | Leave a reply

In Search of the foreach Keyword

Posted on December 26, 2020 by dgookin
Reply

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 →

Posted in Lesson | Leave a reply

Harmonic Series, Divergence, and C Code

Posted on December 19, 2020 by dgookin
2

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 →

Posted in Lesson | 2 Replies

Fun With Series: Fibonacci and Harmonic

Posted on December 12, 2020 by dgookin
Reply

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 →

Posted in Lesson | Leave a reply

My Chicken McNuggets Solution

Posted on December 5, 2020 by dgookin
Reply

Box of 20 Chicken McNuggets, McDonalds
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 →

Posted in Lesson | Leave a reply

The Chicken McNuggets Problem

Posted on November 28, 2020 by dgookin
2

Box of 20 Chicken McNuggets, McDonalds
Chicken McNuggets come several to a box, depending on what you order: six pieces for a kid, nine pieces for an adult, or twenty pieces for an honest adult. These numbers in various combinations form what the math nerds call McNugget Numbers.
Continue reading →

Posted in Lesson | 2 Replies

The Golden Ratio – Recursion Version

Posted on November 21, 2020 by dgookin
Reply

Oh, how I distrusted recursion when I was a budding programmer. It’s just a tough concept to wrap your head around, especially if you’re an old warhorse Assembly programmer like me who lives in fear of blowing up the stack. Trivial asides aside, recursion often presents an elegant and efficient way to solve a programming puzzle.
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Cooked or Raw?
  • Is It a “Real” Triangle? – Solution
  • Getting and Setting the File Position Indicator
  • Is It a “Real” Triangle?
  • A Colorful Hexdump

Recent Comments

  • dgookin on Is It a “Real” Triangle? – Solution
  • Chris Webb on Is It a “Real” Triangle? – Solution
  • dgookin on A Colorful Hexdump
  • Chris Webb on A Colorful Hexdump
  • dgookin on Code Page 437

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress