When I teach C programming, I’m careful to admonish beginners about the difference between the =
(assignment) and ==
(is equal to) operators. Yet there are times when these two operators collaborate.
Continue reading
Author Archives: dgookin
Positive Negative Positive Negative
Difficulty: ★ ☆ ☆ ☆
One of my pastimes is watching math videos. I was a terrible math student, but I enjoy the videos. Occasionally a concept is presented that I can program in C. This month’s Exercise covers one of these concepts.
Continue reading
The C23 Deprecated and Removed Collection
As with all language updates, things change. Some of these items are deprecated while others are outright removed. Here’s the list.
Continue reading
New C23 Language Features
While other programming languages seem to improve and update in great leaps, C moves at a glacial pace. The C23 upgrade offers a few new and exciting features, but nothing I would call impressive or awesome.
Continue reading
Initializing Arrays in C23
You can initialize an array in the C programming languages in three ways: Not at all, only some elements, or all of the elements. Some compilers offer a fourth way, which initializes all elements to the same value. With the C23 standard, yet another way to initialize an array is possible.
Continue reading
The swap() Function – Solution
This month’s Exercise is to code a function that swaps two variables. The challenge really isn’t to swap the variables, but to figure out how to code a function that does so.
Continue reading
Exploring Variable Integer Widths in C23
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
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