Difficulty: ★ ★ ★ ★
Loops are fun. They’re easy to learn. But not everything that repeats in a C program is constructed as a loop.
Continue reading
Loops are fun. They’re easy to learn. But not everything that repeats in a C program is constructed as a loop.
Continue reading
One of the most clever string functions is strstr(), which searches for one string within another. Because of its return value — a char pointer — it’s possible to call this function multiple times to continue searching through the string.
Continue reading
Pointers can drive C programmers mad. In fact, I’d say that evidence of this notion is that the most experienced C programmers have an air of insanity about them. To join their club, try working this month’s Exercise.
Continue reading
I think any kid learning math in school knows what a remainder is, but few understand (or are taught) what a modulus is. It obtains the remainder of one value divided by another, specifically a larger value divided by a smaller value. In C programming, the % (modulo) operator performs this calculation. But what if the C language lacked a modulo operator?
Continue reading
It’s common in programming to use a factorial as a way to teach about recursion. For example, 5! (five factorial) is 5×4×3×2×1, which is 120. Calculating this result can be done with a recursive function, which is practical and satisfying. But mathematicians have a twisted sense of humor, so they invented something called a double factorial.
Continue reading
I remember memorizing the “times tables,” which is how most American kids learn to multiply. Committing single digit multiplication values to memory helps perform multiplication and division problems, but it’s not the only way to calculate the result.
Continue reading
The task for last month’s Exercise was to describe complex data — a matrix. For this month’s Exercise, your task is to multiply these matrixes.
Continue reading
I’ve written many C programming Lessons and Exercises that deal with matrixes. For most of them, such as rotating a matrix, I rely on uniform matrix sizes, like 5×5 or 10×10. This approach makes coding easier, but it doesn’t properly describe every type of matrix.
Continue reading
For me, the scariest part of learning how to program a computer was file access. The problem was the horrid documentation. It introduced both sequential and random file access together without much explanation. So it was with much trepidation that I wrote my first file I/O program. That’s when I realized that the manual was stupid.
Continue reading
If you’ve studied the terminal window at any length, you probably know about the clear command, which clears the screen. Under MS-DOS, and on my old TRS-80, the command is cls. Same thing.
Continue reading