Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

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

Author Archives: dgookin

Post navigation

← Older posts
Newer posts →

The alloca() Function

Posted on March 9, 2024 by dgookin
5

Any memory allocated in a function is retained when the function leaves, unless you first free it. This rule applies to all memory allocation functions — except one.
Continue reading →

Posted in Lesson | 5 Replies

Calculating the Subfactorial – Solution

Posted on March 8, 2024 by dgookin
Reply

Do you feel adequately deranged working this month’s Exercise? I’m more of a math fanboy than an expert, yet I enjoyed the process of coding a subfactorial based in the equation presented.
Continue reading →

Posted in Solution | Leave a reply

Fun with switch case, Part II

Posted on March 2, 2024 by dgookin
6

In last week’s Lesson, I reviewed the switch-case structure and how declared constants aren’t truly the kind of constant a case statement requires. This week I continue my exploration of switch-case, with an interesting and surprising quirk of the default condition.
Continue reading →

Posted in Lesson | 6 Replies

Calculating the Subfactorial

Posted on March 1, 2024 by dgookin
3

Difficulty: ★ ★ ★ ★

Calculating a factorial is a common programming exercise, often coupled with introducing the concept of recursion. Mathematically, the factorial has a twin: the subfactorial. Its calculation can be a fun programming challenge, which is the subject of this month’s Exercise.
Continue reading →

Posted in Exercise | 3 Replies

Fun with switch case, Part I

Posted on February 24, 2024 by dgookin
2

The switch-case construction, or switch statement, provides your code with a decision tree that both easy to read and to debug. This construction is a bit daunting for the beginner, but becomes more familiar as you use it. It’s not without its quirks.
Continue reading →

Posted in Lesson | 2 Replies

Creating Your Own Environment Variables

Posted on February 17, 2024 by dgookin
Reply

Programs use environment variables, thanks to the getenv() function shown in last week’s Lesson. They can also create their own environment variables, reset variable values, and remove variables.
Continue reading →

Posted in Lesson | Leave a reply

Peering into the Environment

Posted on February 10, 2024 by dgookin
Reply

The operating system’s environment provides temporary storage for variables, settings, and options. These values are easily accessible from any C program. One of the first posts I made on this blog was about accessing the environment. Time to revisit.
Continue reading →

Posted in Lesson | Leave a reply

Positive Negative Positive Negative – Solution

Posted on February 8, 2024 by dgookin
4

This month’s Exercise presents what I often refer to as a code “toggle.” Many paths lead to a solution.
Continue reading →

Posted in Solution | 4 Replies

A Nifty Little Test

Posted on February 3, 2024 by dgookin
Reply

When I teach C programming, I’m careful to admonish beginners about the difference between the = (assignment) and == (is equal to) operators. Yet there are times when these two operators collaborate.
Continue reading →

Posted in Lesson | Leave a reply

Positive Negative Positive Negative

Posted on February 1, 2024 by dgookin
2

Difficulty: ★ ☆ ☆ ☆

One of my pastimes is watching math videos. I was a terrible math student, but I enjoy the videos. Occasionally a concept is presented that I can program in C. This month’s Exercise covers one of these concepts.
Continue reading →

Posted in Exercise | 2 Replies

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Storing and Interpreting Mouse Input
  • Where is the Mouse?
  • Pulling Numbers from a String – Solution
  • What is the Mouse Doing?
  • Pulling Numbers from a String

Recent Comments

  • dgookin on Reading Raw Input
  • Chris Webb on Reading Raw Input
  • dgookin on Is It a “Real” Triangle? – Solution
  • Chris Webb on Is It a “Real” Triangle? – Solution
  • dgookin on A Colorful Hexdump

Meta

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

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress