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
Newer posts →

Coin Flipping Madness – Solution

Posted on October 8, 2023 by dgookin
Reply

I hope you didn’t “flip out” over this month’s Exercise. Flipping a coin can be done by hand or by using a computer. Using a computer is easier because it can be programmed to record each flip and it saves you hand muscle molecules for flipping and the chore of writing down the results.
Continue reading →

Posted in Solution | Leave a reply

Finding Characters – Solution

Posted on September 8, 2023 by dgookin
3

The challenge for this month’s Exercise is to write the charcount() function, which returns the number of characters in a string. The character matches exactly, so don’t worry about checking uppercase and lowercase differences.
Continue reading →

Posted in Solution | 3 Replies

From camelCase to snake_case – Solution

Posted on August 8, 2023 by dgookin
2

The challenge for this month’s Exercise is to convert a name from camelCase to snake_case and vice-versa. As usual, several approaches provide a possible solution. The directions were to output the results and not store them, so my solution is rather simple.
Continue reading →

Posted in Solution | 2 Replies

The Sum of the Integer’s Digit – Solution

Posted on July 8, 2023 by dgookin
Reply

The challenge for this month’s Exercise is to tally the digits in an integer, reporting the sum. You must use math and not cheat by looking at the old solution, which I didn’t. Promise.
Continue reading →

Posted in Solution | Leave a reply

Swapping Variables – Solution

Posted on June 8, 2023 by dgookin
2

This month’s Exercise challenges you to swap two variables’ values without using a third variable. It’s a solution widely available on the Internet, but your job is to figure out the technique without looking elsewhere.
Continue reading →

Posted in Solution | 2 Replies

Yesterday – Solution

Posted on May 8, 2023 by dgookin
Reply

The challenge for this month’s Exercise is to output yesterday’s date: the day of the week, day of the month, month, and year. It’s not as complex as it could be, though keep in mind that any code that outputs the proper result is valid.
Continue reading →

Posted in Solution | Leave a reply

Counting the Non-ASCII Bytes – Solution

Posted on April 8, 2023 by dgookin
2

Several items are noteworthy for this month’s Exercise , with the biggie being how to detect a non-ASCII character. The secret involves a wee bit of type conversion.
Continue reading →

Posted in Solution | 2 Replies

Merging Arrays – Solution

Posted on March 8, 2023 by dgookin
Reply

This month’s Exercise is about coding a merge() function, which swallows two arrays and generates a third as output. The new array is “zippered” from the original arrays, alternating values from each.
Continue reading →

Posted in Solution | Leave a reply

A Compact for Loop – Solution

Posted on February 8, 2023 by dgookin
3

I hope you were able to cram a lot of expressions into a for loop statement, which is the challenge for this month’s Exercise. Even if you know this trick, it’s important to understand it’s limitations — which is something I discovered during my research.
Continue reading →

Posted in Solution | 3 Replies

How Big is That File? – Solution

Posted on January 8, 2023 by dgookin
6

The challenge for this month’s Exercise is to return a file’s size without using the stat() function. My goal is to get you to think about various file tools and how they can be useful beyond their intended purpose.
Continue reading →

Posted in Solution | 6 Replies

Post navigation

← Older posts
Newer posts →

Recent Posts

  • Ctype Functions: isgraph() and isprint()
  • Ctype Functions: isalnum(), isalpha() and isdigit()
  • Ctype Functions: isupper() and islower()
  • Ctype Functions: toupper() and tolower()
  • Pointers to Multi-Dimension Arrays – Solution

Recent Comments

  • Chris Webb on Ctype Functions: isupper() and islower()
  • M.Stumpfl on Ctype Functions: toupper() and tolower()
  • M.Stumpfl on Ctype Functions: isupper() and islower()
  • dgookin on Ctype Functions: isupper() and islower()
  • dgookin on Ctype Functions: toupper() and tolower()

Meta

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

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress