Difficulty: Easy
The C compiler preprocessor is a sneaky and powerful thing. I’m unsure of any other programming languages that have such a tool.
Continue reading
The C compiler preprocessor is a sneaky and powerful thing. I’m unsure of any other programming languages that have such a tool.
Continue reading
Your bank receives two deposits or credits and three bills or debits. The credits cover the debits, meaning that your balance should never go below zero, but the bank has clever software: The bills are calculated first, which thrusts your account into negative territory complete with fees — even though the deposits cover the bills. Is this obnoxious behavior the result of greedy bankers or clever programming?
Continue reading
The strcmp() function returns a value based on the comparison of two strings. The value is zero when the strings match, otherwise the value is positive or negative depending on how the strings compare. This result makes me wonder which other functions can return positive, negative, or zero values and whether the C library has a sign() function or similar that helps make such a determination.
Continue reading
Removing redundancies from your C code may not be your first goal, but it’s something you can definitely find later. One example is when you must initialize a pair of arrays. Why use two loops when one will do?
Continue reading
If given a pad, pencil, and a factor problem years ago, I would have found doing anything else in the world more exciting. Math is not my forte, yet it remains a curiosity. Especially with The Power Of The Computer, performing math exercises is more of an interesting challenge than a mental ordeal.
Continue reading
The three units of weight I’m familiar with are pounds, kilograms, and stone. For me, stone is the odd one. I’ve heard it used in Britain and it’s completely baffling to me, often requiring that I whip out a calculator to see what “14 stone” really means. Better, I could write code that converts between pounds, kilograms, and stone, which is the goal of this month’s Exercise.
Continue reading
I recently updated my Wambooli website’s front page to show only recent blog posts. I don’t regularly maintain the Wamblog any longer, so it was disappointing for me to see “recent posts” from ages ago. Therefore, I did a little coding to ensure that only recent posts appear or nothing.
Continue reading
I remember the first time I heard the puzzle: If you’re paid a penny on the first day, doubled on the second day, and doubled every day after, by the end of the month you’d be a millionaire many times over. This concept is mind boggling.
Continue reading
I would guess that most beginning programmers can deftly craft a loop that outputs sequential integer values, say from 0 to 100. In fact, this is the type of code I write whenever I learn a new language. I asked myself, “Can I write a loop to output values 0 to 100?” Usually in no time, I’ve constructed such a program. Simple.
Continue reading
![]()
I enjoy playing number games. I’m not good at it, but I enjoy playing them. Recently such a game piqued my curiosity enough to consider it for my monthly C For Dummies exercise: 21
Continue reading