Prime numbers are a popular topic in computer programming. It surprised me that I hadn’t yet plumbed primes on this blog, so I’m past due. And forget about the nerdy aspect of prime numbers. Of all the concepts in mathematics, primes are something most people understand.
Continue reading
Category Archives: Lesson
String Versions of ctype Functions
The ctype functions are marvelous for single character manipulation and testing. Often, however, the functions appear in a loop so that they can be applied to an entire string. So why not write a string-based ctype function? Of course, that’s what I did.
Continue reading
Is This Unix?
In the beginning, Ken Thompson, Dennis Ritchie, and others created Unix. And it was good. Then came the varieties and variants: BSD, System V, and eventually Linux. These are all similar operating systems, not identical, but with a common root and familiar features. You can’t call them all “Unix,” so over time various standards and terms have been developed.
A term that frequently pops up when ruminating over the various Unixes and Linux distros, is POSIX.
Continue reading
The Terminal Has a Name
In Linux and Unix, the terminal is assigned a name. Specifically, it’s the name of a file located in the /dev directory. This configuration is necessary because the operating system treats all devices as files. Like a file, you can read and write from the terminal; it’s an I/O device. To get started, you must know the current terminal’s filename.
Continue reading
What is the Maximum Value?
One of the first functions C programmings learn is max(). It’s simple and useful, and it teaches a lot about functions and evaluations. Most programming languages also demonstrate functions similar to max().
Continue reading
Looping with Testing Variables
Often in my code I use a variable to both fetch data and to test the data. Before using this variable, it must be initialized, lest the test act on uninitialized garbage. A clever solution is necessary to avoid this situation.
Continue reading
The Most Curious Aspect of the scanf() Function
It’s incorrect to say that the format string for the printf() function is identical to the one used in the scanf() function. Both are similar, but scanf() has one major difference.
Continue reading
Fully Abusing the scanf() Function
It’s sad but understandable that most C programmers use the scanf() function in a limited capacity. True, the function is dorky, so I accept any aversion to its use. It can also be abused to pose a security risk. Still, for “research purposes,” it’s entertaining to see how much the function can be twisted and torqued.
Continue reading
Unraveling the scanf() Function
One of the things I dread in my books, is foisting the scanf() function upon a beginner. I have no way around this frustration.
Continue reading
Initializing an Array

Like all variables in C, arrays are declared uninitialized. They contain whatever junk already exists in memory. Initializing an array is therefore important. It can be done in one of three ways: as it’s declared, in a loop, or as it’s used in the code.
Continue reading