You would think that I’d be deeply into Dungeons and Dragons, but no. I can’t stand the game. I find it tedious and predictable, boring. But I did enjoy rolling all those dice. Who knew that a 20-side die is a thing — and that rolling a “nat 20” is a big deal?
Continue reading
From Base 36 to Decimal
Continuing my Base 36 series, from last week’s Lesson, the base35_string() function successfully converts a decimal value into its base 36 representation. To verify that the conversion works, another function is necessary to convert base 36 strings into their decimal equivalents.
Continue reading
From Decimal to Base 36
The next step in my Base 36 series is to translate a decimal value into its base 36 representation. In last week’s Lesson, code was presented to build a powers table and slice a decimal value into its base 36 components. This Lesson completes the task with a function, base36_sting() to build and output a base 36 value.
Continue reading
The Reversing Filter – Solution
This month’s Exercise presents more than a traditional filter. Instead of input being processed and immediately output, the input must be stored. Further, the storage quantity is unknown. Therefore, to provide proper storage the code must employ an expanding buffer. This condition means that the solution relies upon the scariest aspect of C programming: pointers!
Continue reading
Base 36 Powers
To build a number in base 36, you need to know the powers of base 36. This information is required to output digits — 0 through 9 and then A through Z — in the proper order to represent a base 36 value. This task may seem complicated, but it’s the same process that takes place for any counting base.
Continue reading
The Reversing Filter
Difficulty: ★ ★ ★ ☆
Filters are fun to code and useful, such as the more filter in Linux that pages text output. For this month’s Exercise, your task is to write a text reversing filter. This program is a bit more challenging than coding other types of filters.
Continue reading
Base 36
This month’s Exercise output values in various bases, but only those bases from 2 to 10. For other bases, especially those that alien beings might use, more effort is required. Therefore, I’d like to begin exploring a ridiculous counting base, base 36.
Continue reading
The _Alignof Keyword
The C11 standard added a few new keywords to the language. These are often called the “underscore keywords” because each is prefixed with an underscore. The second letter is often capitalized, as is the case with _Alignof.
Continue reading
Searching a Binary Tree
As you might suspect, searching a binary search tree (BST) involves a recursive function. This function must plow through the tree, finding a value in a specific node. Because the BST is organized, the search process works far more quickly than when the data is unorganized or set in a sequential array. In fact, the bsearch() function uses a similar scheme requiring that the data first be sorted before the function works its magic.
Continue reading
Pick the Base – Solution
Your task for this month’s Exercise is to write a program that outputs a value in any base, between 2 and 10. Sure, you can use this code to communicate with alien species that use a base other than decimal, but this benefit is only a happy coincidence to the exercise.
Continue reading