In last week’s Lesson, I covered the goto keyword the way most instructors do: I explained that it’s not needed and admonished you not to use it lest you be labeled an complete and utter dork. Still, why would such a superfluous method of program control be included if it’s awkward and unnecessary?
Continue reading
Author Archives: dgookin
Goto Hell
The only reason anyone learns about the C language keyword goto is because it’s one of the original 32 keywords. The next thing a programmer learns is to avoid it. Peril, pestilence, and pain awaits the fool who uses goto. Yea verily, if a programming Hell exists, goto is the command you use to get there.
Continue reading
Wide Characters and Unicode, Part IV

String input is a weird thing when it comes to wide characters, mostly because how the heck do you type wide characters in a terminal window beyond copy-and-paste?
Continue reading
Wide Characters and Unicode, Part III

Programming is a fun hobby because once you unlock and open a door, you immediately find another locked door. Normal humans would experience frustration, but a good programmer enjoys a challenge and even sees the humor in the situation. A case in point is learning how to program wide characters in C: Once you think you’ve cleared a huge hurdle, you find another, taller one right behind it.
Continue reading
Change Due – Solution
I confess, the solution to this month’s Exercise was frustrating. Several times, I thought to abandon the premise and focus on the main problem, which is how to create a random price, such as $5.32, without that floating-point value really being 5.3187321.
Continue reading
Change Due
Consider the penny. It’s one cent, which was once a worthy sum before the government devalued the currency to the point where trays of pennies linger unwanted on convenience store checkout counters across the land. Why not do away with the penny?
Continue reading
Wide Characters and Unicode, Part II

After you set the necessary locale for your program, you’re free to use the wide character functions defined in the wchar.h header file. For some reason, this process is poorly-documented on the Internet, which is probably why you’re here.
Continue reading
Wide Characters and Unicode, Part I

At the dawn of the microcomputer era, lowercase text was considered a big deal. That’s because many home computers at the time displayed only uppercase letters. Memory was tight. Full-ASCII character generators added to the system’s cost. Yes, a microcomputer that displayed lowercase text was a big deal.
Continue reading
The “Gazinta” Function
Division is the last of the four basic arithmetic operations taught. Addition is easiest, followed by subtraction. Multiplication is merely aggressive addition. Division is a weird un-multiplication combined with subtraction thing, which is probably why educators save the concept for last.
Continue reading
The Elvis Operator

A new operator was added to the C language in the last revision, one that I don’t cover in my books. (I’m not sure how that happened.) Anyway, it’s the Elvis operator. Unless you’re a fan of the ternary operator, you’ll probably never use it.
Continue reading