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: Solution

Post navigation

← Older posts

Heron’s Formula – Solution

Posted on October 8, 2025 by dgookin
Reply

The challenge for this month’s Exercise is to code Heron’s Formula. This geometric magic calculates the area of a triangle given the length of each of its three sides.
Continue reading →

Posted in Solution | Leave a reply

The Reversing Words Filter – Solution

Posted on September 8, 2025 by dgookin
2

The task for this month’s C programming Exercise is to code a filter that reverses single words. As a filter, the code deals with standard input and output, but it must store this input in word-sized chunks for the reversing process to work.
Continue reading →

Posted in Solution | 2 Replies

Your Name in Base 36 – Solution

Posted on August 8, 2025 by dgookin
Reply

My solution for this month’s Exercise didn’t require much work. What I did was to “stack overflow” the problem by pulling in functions from earlier Lessons. The only new portion of code deals with processing the input before sending the string off to the b36_decimal() function I’ve already written.
Continue reading →

Posted in Solution | Leave a reply

The Reversing Filter – Solution

Posted on July 8, 2025 by dgookin
2

This month’s Exercise presents more than a traditional filter. Instead of input being processed and immediately output, the input must be stored. Further, the storage quantity is unknown. Therefore, to provide proper storage the code must employ an expanding buffer. This condition means that the solution relies upon the scariest aspect of C programming: pointers!
Continue reading →

Posted in Solution | 2 Replies

Pick the Base – Solution

Posted on June 8, 2025 by dgookin
2

Your task for this month’s Exercise is to write a program that outputs a value in any base, between 2 and 10. Sure, you can use this code to communicate with alien species that use a base other than decimal, but this benefit is only a happy coincidence to the exercise.
Continue reading →

Posted in Solution | 2 Replies

Formatting a Series for Output – Solution

Posted on May 8, 2025 by dgookin
Reply

The challenge for this month’s Exercise is to output a series of numbers, 1 through 10, and to ensure that the final number doesn’t look dorky. I’m certain that’s what I asked for.
Continue reading →

Posted in Solution | Leave a reply

Keep Finding That String – Solution

Posted on March 8, 2025 by dgookin
Reply

The task for this month’s Exercise is to repeatedly call the strstr() function, locating all instances of one string (“needle”) inside another (“haystack”). Obviously your first task, which also helps with the solution, is to perform error checking on the return value from the strstr() function.
Continue reading →

Posted in Solution | Leave a reply

Testing Your Pointer Prowess – Solution

Posted on February 8, 2025 by dgookin
Reply

The solution for this month’s Exercise is to output the string "I am an excellent C programmer". This task isn’t so simple when you must untie the knot of the dratted double pointer.
Continue reading →

Posted in Solution | Leave a reply

Emulating the Modulus Operator – Solution

Posted on January 8, 2025 by dgookin
Reply

In an alternative universe, the C programming language lacks a modulus operator and no companion function exists in the library. What to do! Why, you code your own modulus function, which is the challenge for this month’s Exercise.
Continue reading →

Posted in Solution | Leave a reply

The Double Factorial – Solution

Posted on December 8, 2024 by dgookin
Reply

This month’s Exercise is to write code to calculate a double factorial, which uses the !! notation. A double factorial works like a factorial, but uses only odd or even values based on the parity of the starting value.
Continue reading →

Posted in Solution | Leave a reply

Post navigation

← Older posts

Recent Posts

  • The Ever-Expanding Pointer Array
  • Heron’s Formula – Solution
  • Coding a Better stringcopy() Function
  • Heron’s Formula
  • Copying Strings

Recent Comments

  • dgookin on Heron’s Formula
  • Chris Webb on Heron’s Formula
  • dgookin on Heron’s Formula
  • Chris Webb on Heron’s Formula
  • dgookin on Finding Those Pesky Null Characters!

Meta

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

Copyright © 1997-2025 by QPBC.
All rights reserved

Proudly powered by WordPress