
I wouldn’t say that the isupper() and islower() functions are the opposite of the toupper() and tolower() functions, though they do play well together. This week I continue my exploration of the ctype functions.
Continue reading
Ctype Functions: toupper() and tolower()

The easiest way to mess with characters in C is to employ the ctype functions. I name this category of library functions after the ctype.h header file that defines them. Some are true functions, some are macros. Each function can be replicated with standard C code, though it’s quicker to use an established function than to code your own. But that’s not the point of learning to program!
Continue reading
Pointers to Multi-Dimension Arrays – Solution
The challenge for this month’s Exercise is to use pointers to work through a multi-dimensional array. As I mentioned in the exercise post, multi-dimensional arrays are all stored as a single-dimension where the compiler calculates offsets for rows and columns (and more) for you.
Continue reading
The Ctype Functions

Any C programmer eager to mess with characters or strings knows about the handy ctype functions. I use this name because these functions, which include a few macros, are defined in the ctype.h header file. Their job is to manipulate and examine characters.
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
Obtaining the Averages

The point of extracting data chunks from a grid is to obtain the average of their values. This approach is how I reduce the massive amount of data stored in an image for representation as ASCII text. (See the thumbnail above.)
Continue reading
Extracting Data Chunks

The next step in dividing a grid of data into chunks is to extract each of the chunks. Last week’s Lesson used color to visually identify the data chunks. This week’s update to the code pulls these chunks from the grid, using their values and colors to confirm that everything matches up properly.
Continue reading
C Blog 13th Anniversary

Today marks the 13th anniversary of this blog’s first post. The blog didn’t go live for a few months, specifically to ensure that I would A) keep up the posts (a fault with many blogs) and B) have plenty of material for visitors to peruse. It’s been going strong and consistently since that original post, April 13th, 2013.
Continue reading
Colorful Data Chunks

Continuing from last week’s Lesson, my goal for the grid is to split it into chunks which are then reduced based on the average value of each chunk. To best visualize this, I’d like to keep the byte patterns in the grid consistent and — as a bonus — color-code them.
Continue reading
A Little Bit Off the Sides – Solution
The C language woefully lacks a trim() or similar string manipulation function. Rather than let it flail in absent envy, your task for this month’s Exercise is to code such a function. The goal is to remove whitespace characters from either end of a string.
Continue reading