Finding things is an unwanted pastime for humans. “Where are the good scissors?” “Who has seen the cat?” “What happened to all my money?” These issues don’t exist for a program that dutifully locates any data tidbit without complaint. Finding the smallest needle in the largest haystack isn’t an issue for a computer.
Continue reading
Category Archives: Lesson
Building a String
Programming language more modern than C sport great libraries of functions, or “methods.” Java has so many I doubt that a single programmer knows them all. In C, however, when a function is absent (and a lot of them are, comparably), you must code your own. Such is the case with building a string.
Continue reading
The Pig Latin Translator, Part III
The final step in my Pig Latin journey is to process an entire English language sentence. The piglatin() function, finished in last week’s Lesson, requires no updates. But chopping a sentence into words and sending them off to be processed individually proved to be an interesting exercise.
Continue reading
The Pig Latin Translator, Part II
From last week’s Lesson, the piglatin() function swallows a word and returns its Pig Latin translation, but only for words starting with a vowel. The operation for words that begin with a consonant is more complex.
Continue reading
The Pig Latin Translator, Part I
One of my older C programming books featured a sample program that translated English words into their Pig Latin equivalent. It’s time to revisit this code.
Continue reading
What is That Defined Constant’s Value?
The C language uses defined constants to represent consistent values across platforms. For example, the PATH_MAX value might be 260 on one system and 4096 on another. It’s not important to know the specific value, just use the defined constant and your code builds and runs on various systems (hopefully).
Continue reading
Sorting the Hexwords, Part II
The problem with the code from last week’s Lesson is obvious: The decimal value of FEED is 1,044,205, not 2,314,885,530,818,453,605 as shown in the output. Before I can sort the list numerically, this error must be addressed.
Continue reading
Sorting the Hexwords, Part I
The Linux dictionary stores its words sorted alphabetically. Therefore, the output from the program presented in last week’s Lesson shows valid hexwords (letters A through F, four letters or longer) in alphabetic order. But what if I want the words output in numerical order?
Continue reading
The HexWord Tally and Total
The dictionary is full of words composed of only the letters A through F, which are also hexadecimal digits. These English language hexwords can be pulled from the computer’s digital dictionary, which was demonstrated in last week’s Lesson. Time to update the code!
Continue reading
HexWords
Hexadecimal, or counting base 16, uses letters A through F to represent values 11 through 15. This base — “hex” — is common in programming as it works as a shorthand for binary values. But the letters used are also letters, which means that they can spell words.
Continue reading