I’ve not installed Code::Blocks on a Linux computer, but for a moment I’ll pretend that such an installation has the same issue I described in last week’s Lesson: You must manually link in the C language math library to create any program that uses a math.h function.
Continue reading
Category Archives: Lesson
Link in the Math Library
Recently, I had question posed to from a reader from Norway. He was working his way through my book and found that one of the programs wouldn’t compile on his Linux computer. The problem was that the C language math library isn’t automatically linked. The effect is that a linker error appears upon compiling.
Continue reading
Fuzzy Matching, Now With Forgiveness
Even when you add fudge to a matching system, occasionally that odd bit of data — the outlier — can wreck an otherwise close match. The question is, how many of those mismatches does your code allow?
Continue reading
Fuzzy Matching with Percentage Variation
A fuzzy match that uses discrete amount of fudge might not yield a match, especially when the values cover a wide range. To better make the match work, set a percentage variation instead.
Continue reading
Fuzzy Matching Tolerance
Comparing values is a discrete process; an if comparison is absolute. The result is either true or false. Never is the result perhaps or somewhat — unless you add some fudge to the comparison.
Continue reading
Non-Identical Yet Very Similar
Computer’s are notoriously obedient and serious. They’re exact. If you give them inaccurate instructions or bad data, the computer does its job without question. But the real world isn’t binary and often times it’s necessary to add some forgiveness into your code.
Continue reading
That’s Not the Input I Asked For
I recently had a reader submit a question regarding input. He wanted to write code that would read a character and display that character’s ASCII code value. It sounds like a simple program, but you must understand variable types and the scanf() function’s peculiarities to properly code it.
Continue reading
Basic Output
The typical first program taught to anyone learning C (or any other programming language) is Hello, world! It’s fun, which sets up false expectations, but it’s also genius.
Continue reading
The byteflip() Function
When I recently researched byte-flipping on the Internet, I was surprised that the solution I used back in the 1980s wasn’t listed among the top solutions available today. That’s probably because my brain thinks like an Assembly Language programmer, so I crafted a low-level solution.
Continue reading
Flipping a Byte
One of the first programming puzzles I solved on my own was a byte flip. That’s the process for taking a binary value and flipping it: You transpose bits 0 through 7 to bits 7 through 0. This is a puzzle that comes up frequently in programming, but one for which no single solution is preferred.
Continue reading