The Clock Angle Problem

Reading an analog clock is a skill that some kids need to master these days. Oh, I’m sure that eventually everyone figures it out. When I was a kid, digital clocks were rare. No, we all learned how to tell time by looking at a round disk with 12 numbers and a big hand and a little hand. If a second hand was available, well it was just more entertainment for the terminally bored child.
Continue reading →

Pointers to Multi-Dimension Arrays

Difficulty: ★ ★ ★ ☆

I received a question via email regarding my recently-published book, Dan Gookin’s Guide to C Language Pointers (available at Amazon!). The question: How to use a pointer to navigate a multi-dimension array? While I do cover pointers to an array of strings (which is kinda what the reader wanted), I don’t specifically cover pointers and multi-dimensional arrays. Therefore, I created this month’s exercise to tackle the task.
Continue reading →

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 →

Pulling Numbers from a String

Difficulty: ★ ★ ★ ★

Rarely in your programming journey will you encounter a situation where the data you need just pops up fresh, exactly the way you want it. The best situation is where the data is somehow formatted, which makes finding the tidbit you want easier. But often the data is unformatted, which makes fetching that one useful morsel a bit tricky.
Continue reading →