As C evolved, so did the definitions for integer sizes short, int, and long. Back when I first coded C, a short was 8-bits, an int was 16-bits, and a long was 32-bits. These values aren’t the same today or even consistent across platforms. This issue is addressed in the C23 standard by using the _BitInt() data type.
Continue reading
Author Archives: dgookin
The swap() Function
Difficulty: ★ ★ ★ ☆
Swapping values is common task in computer programming, often used when sorting. You need the value of variable a in variable b and vice-versa. A number of methods are available for swapping, most of which involve using a temporary variable to hold one of the values during the swap.
Continue reading
Binary Notation in C23
While the C language offers hexadecimal notation and output, it ignores binary. Now with the C 23 standard, binary expression and output is supported.
Continue reading
Testing for C23 Compatibility
The C23 standard is only partially implemented on a few compilers. To ensure that you can build C23 programs, you must obtain the latest compiler version from your distro’s package manager. Even then, not all the C23 capabilities may be available.
Continue reading
Welcome C23
The next C standard is established and it’s slowly being implemented. If you have the latest version of the C compiler installed on your system, you can take advantage of some of the fun and improved features of the C programming language.
Continue reading
Initializing Only Part of an Array
I’m continually amazed when I discover some aspect of the C programming language that I’ve not encountered before. This time, the trick is how to initialize individual array elements.
Continue reading
Tetration – Solution
Tetration is a bizarre mathematical concept. I’ve watched quite a few YouTube videos where math geeks explain the details. They venture into the terrifying territory of humongous numbers that would consume the known universe. Your programming challenge for this month’s Exercise is far less massive.
Continue reading
Almost a Spelling Bee-Like Scan
Scanning the digital dictionary is fun, but it’s gone on way too long! I was going to end this series with code that solves the Spelling Bee game, but decided to end things with this Lesson. This final post scans the dictionary for words that match a given clutch of characters.
Continue reading
Tetration
Difficulty: ★ ★ ★ ★
Tetration is a mathematical process that generates obnoxiously huge numbers quickly. It’s exponentiation on overdrive. The concept is insane, but it’s also something you can code in C.
Continue reading
Finding All the Pangrams
I introduced the pangram concept in last week’s Lesson. The code demonstrated how to locate 7-letter words where no letter repeats, based on the online game Spelling Bee. But a pangram need not be limited to just seven letters.
Continue reading