The for keyword opens the door to looping in C, as well as in other programming languages. When teaching this concept, I keep the for loop format simple. After all there’s a lot of cryptic stuff between those parenthesis. And — brace yourself — there’s room for a lot of other stuff as well.
Continue reading
Category Archives: Lesson
Creating Your Own Library
Anyone who’s programmed in C for a while has worked with other libraries. In Linux, it’s common to link in the math library, libm.a. Other libraries are available to expand what the C language can do. I have books available on Ncurses, curl, XML and JSON, each of which has a library that makes it easy to use these powerful utilities. But what about making your own library?
Continue reading
What the Heck is This?
As I plow the digital seas, I often come across a piece of programming flotsam worthy of investigation. Most of it is obfuscated C, which is delightful. The obfuscated code that outputs something wonderful is most entertaining. But every so often I stumble upon something perplexing like the following code:
Continue reading
Recursion Until Death!
When I first learned Assembly Language, I had a fear of blowing up the stack. Remember, back in the 8-bit microcomputer era that memory space was tight, maybe only part of 64K. A stack would have 1K of storage, if that. I think the stack size on my TRS-80 was 256 bytes. (An address was only two bytes wide.) This limitation meant that pushing too much data on the stack would blow up the computer.
Continue reading
Happy 250th, USA!

Today is Independence Day in the USA. Two hundred and fifty years ago, this nation’s founding fathers signed the Declaration of Independence. While I’ve had posts dated July 4 previously on this blog, today is a special anniversary. It necessitates a specific C language program.
Continue reading
Ctype Function: isxdigit()

The ctype isxdigit() function returns TRUE for any digit you find in a hexadecimal number. I suppose this function has a role to play, most likely in detecting hexadecimal characters in a string. Regardless, this post wraps up my exploration of the ctype functions.
Continue reading
Ctype Function: ispunct()

For the ctype ispunct() function, the goal is to understand that “punct” is short for punctuation and not puncture. To put this function to use you need to know what the library considers to be an ASCII punctuation character. It’s yet another step forward in my ongoing exploration of the ctype functions.
Continue reading
Ctype Functions: isascii() and iscntrl()

I almost believe these two functions to be useless, but they do play an important role in the ctype pantheon: isascii() determines whether an integer value is an ASCII character, and iscntrl() lets the program know further whether an integer value is also an ASCII control code. This pair adds to my continuing exploration of the ctype functions.
Continue reading
Ctype Functions: isblank() and isspace()

You can draw a blank and you can get spaced out, so there’s a difference in the English language between the words “space” and “blank.” This difference doesn’t explain how the ctype functions isblank() and isspace() work. In this Lesson, I cover these two functions and their differences, as I continue my exploration of the ctype functions.
Continue reading
Ctype Functions: isgraph() and isprint()

Two very similar ctype functions are isgraph() and isprint(). Only one character separates the two functions. And the isgraph() function has nothing to do with graphics. These are the topics for this week’s Lesson as I continue my exploration of the ctype functions.
Continue reading