The defined constant NULL represents a null or empty pointer. I’ve written before that the constant isn’t defined as zero, though such an assumption could lead you into trouble.
Continue reading
Author Archives: dgookin
Eight Years of the C For Dummies Blog
Today marks 8 years that this blog has been online. The first post was made April 13, 2013. The blog was up for a few months before the book C Programming For Dummies was released. This way material would be available for the first readers.
Continue reading
Positive or Negative Zero
Mathematicians truly enjoy doing their math thing. As a mortal human, I don’t have a spot for math things on my “fun” spectrum. Yet, one of the more jolly things the math nerds do is discuss the value zero.
Continue reading
Balancing Accounts – Solution
I hope you had a wee bit of a struggle with your solution to this month’s Exercise. It involves a lot of decisions and proper steps in the right order to hold off on debits so that the bank account never dips below zero.
Continue reading
Sign Bits
I recall the math class where negative numbers were introduced. I was appalled. From Star Trek, I easily accepted the concept of antimatter, but the notion of negative values deeply offended me.
Continue reading
Balancing Accounts
Difficulty: Medium
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
Options for the strfmon() Function
The strfmon() function, introduced in last week’s Lesson properly formats a monetary value for specific regions. To unlock the function’s various features, you must understand and use formatting placeholders.
Continue reading
Exploring the strfmon() Function
The C programming language doesn’t sport the thousands of functions (or methods or what-have-you) available in Java. They say Java programmers may never use or even know the variety. With many fewer functions available in the standard C library, I would think to know them all. Then along comes another one I’ve neither used nor heard of. This week’s Lesson covers such as function, strfmon().
Continue reading
An Update to My strcasecmp() Function
Many moons ago, I wrote about the non-standard function, strcasecmp(). It works like the C library function strcmp(), though it ignores character case. Turns out my return value from the function isn’t exactly correct.
Continue reading
Positive, Negative, or Zero – Solution
Your challenge for this month’s Exercise is to write a sign() function, which returns 1, 0, or -1 depending on the sign of an integer. A relatively simple thing to code — I hope!
Continue reading