
I recently embarked upon a programming project where I must reduce large chunks of data into more manageable pieces. The general topic is computer graphics, so a bit of data loss when reducing an image is expected. But before working with the graphical data itself, I decided to run a test on a random chunk of data to confirm whether I was on the right track.
Continue reading
Author Archives: dgookin
A Little Bit Off the Sides
Difficulty: ★ ★ ★ ☆
As you might already know, the C language lacks plenty o’ functions readily available in other programming languages. Many of these functions, or “methods,” deal with strings. Though C includes a few basic string functions in its library, the C Lords have determined that when you need another such function, you must code it yourself.
Continue reading
From Decimal to Fraction
I was surprised to discover that I hadn’t written about this topic before: converting a decimal value into a fraction. Of course, the solution is really stupid — which I’ll show in a moment. But the goal is to reduce or simplify the stupid way and end up with a fraction instead of a decimal.
Continue reading
Bonus π Day 2026
The next time March 14 drops on a Saturday will be in 2037. Yes, I will be long retired by then. Or perhaps the C language will finally be retired. Who knows? Regardless, here’s another program that uses some obscure mathematical mumbo-jumbo to calculate the value of π.
Continue reading
π Day 2026
It’s been a few years since I’ve had π day here on the C blog. Because I schedule posts for Saturdays, only thrice has a post fallen on π day: In 2015, 2020, and now in 2026.
Continue reading
What is the Largest Value – Solution
Once again, the challenge for this month’s exercise is to unravel a math puzzle. This time, the puzzle reads like this:
Continue reading
The Final Task for Mousing Around

I promise that this is the final post dealing with reading a mouse in a terminal window. It’s a weird thing to do without a specific library in C, but made possible thanks to ANSI codes and the standard I/O programming necessary to read and store the data.
Continue reading
What is the Largest Value?
Difficulty: ★ ★ ☆ ☆
Of all the crazy stuff that happens in the realm of mathematics, I’m certain that mathematicians must enjoy solving math puzzles — just like I assume that good programmers enjoy solving programming puzzles.
Continue reading
Accessing the Mouse in a Terminal Window

The point of reading and capturing mouse data is to do something at the mouse’s location. Specifically, the goal is to have the terminal somehow react to a mouse click. Yes, even though C is stream oriented and rarely involves graphics or the mouse, this feat is made possible thanks to ANSI commands.
Continue reading
Storing and Interpreting Mouse Input

Spewing data all over the screen might look impressive, as shown in last week’s Lesson, but the point of knowing where the mouse is and what it’s doing is to capture its data and make it available to your program for interpretation.
Continue reading