Once you accept that a program’s data set is flexible, you must abandon all constants and use variables. It’s a good move: The variables ensure that no matter what changes with the data, the code can handle it.
Continue reading
Author Archives: dgookin
Right String – Solution
For this month’s Exercise, I offer both a string function solution as well as a solution that uses pointers. As you can guess, I thought of the string method first, which is where most programmers would run to avoid the dratted topic of pointers.
Continue reading
Sorted List Presentation, Part II
It’s easy to code single-column list output. It takes a bit more programming skill to present the list in columns. To sort the list by columns is the most difficult. Like many programming tasks, it’s one of those things that once you figure it out, you just keep stealing your own code to do it again and again.
Continue reading
Right String
A recent web page programming puzzle reminded me of an old BASIC language function, RIGHT$. The “right-string” function returns the rightmost n characters from a string. Such a function would have helped me greatly in my web page programming task.
Continue reading
Sorted List Presentation, Part I
Sometimes programming can be a snap, especially when you have a known data set and pretty much all the values are static. You can whip out code right away, it runs well and looks beautiful — but that’s because everything is known. The fewer variables, the easier to code.
Continue reading
Structures of Pointer Structures in Structures
Nested structures present another opportunity for pointers to growl in your code. The struggle is knowing which structure member operator to use — and where.
Continue reading
Pointers on Pointers in Structures
Structures are the complex variable type in C, allowing you to craft data-rich units for storing and retrieving all sorts of interesting information. They’re fun! But like asterisks falling as snowflakes, sprinkle some pointers into a structure and you can get into trouble fast.
Continue reading
Ugly e Math Stuff
I’m no math genius. I’d love to understand it all, and I appreciate the complexities, but I’m just the noob first-time player walking across a field in Call of Duty where I’m a target to all the more experienced players. In short: The study of compound interest eventually gives rise to the mathematical concept of e, also known as Euler’s number.
Continue reading
The URL Decoding Filter – Solution
Unwinding percent-encoding involves three steps:
- Pass-through the unchanged characters.
- Change
+back into a space. - Decode the percent strings, which is the most involved process.
Compound Interest Calculations
You would think that simple interest (from last week’s Lesson) would be enough. After all, if you’re investing, you make money; if you’re paying back a loan, you can figure the math. That aspect of interest wasn’t enough for mathematical and banking geniuses, who devised a second type of interest calculation, which is “interest on the interest.”
Continue reading