It was a simple contest: Write code that displays the first 100 prime numbers. The person who wrote the fastest code won.
Continue reading
Variable Tab Width, Part II
Last week’s Lesson discussed the tab character and how it’s used to line up text in a terminal window. This Lesson shows you how such a calculation is made and coded.
Continue reading
Numbers With Commas
As a programmer, you’re used to seeing values like 1000 or 1234999. Your users aren’t. They prefer to see values presented as 1,000 or 1,234,999.01. Or, in Europe the format may look like this 1.000 or 1.234.999,01.
Continue reading
Variable Tab Width, Part I
The tab character, 0x08 or ^I (Control-I), is always the same width, no?
Continue reading
Array Zing Hell
An array is a queue of values, all stored as one compact unit with a handy reference method. As you study arrays, especially when you get into pointers, you discover something interesting about the array’s first element.
Continue reading
Make a New String On-The-Fly
Never underestimate the power of the printf() function. It has amazing abilities to format output. And don’t forget about printf()‘s lesser-known cousin, sprintf(). It can do amazing things with strings.
Continue reading
Duck-Duck-Goose and Moduluse
There is no such word as moduluse, but the C language does feature the modulus operator, %. You can employ that operator do count off intervals, which allows you to manipulate information in a consistent and interesting way.
Continue reading
Every Other One
You should be familiar with the C language modulus operator, %. Even if that familiarity is fear or confusion it’s still familiarity.
Continue reading
Test Your Formatting Knowledge
In late September and early October, I wrote a series of lessons on how the various printf() formatting commands are used. Now it’s time to put your skills to the test.
Continue reading
Schizoid Operators
The C language features a host of symbols that take on different meanings depending on how they’re used. Unless you’re careful, these operators’ multiple personalities can confuse the bejeebers out of you.
Continue reading