Seeing the limitations of the C library input functions, I set out a long time ago to craft my own input function. It does exactly what I need, which is the charm of writing your own functions — and the beauty of the C language because it gives you access to the low-level tools that allow for such play.
Continue reading
C Language String Reading Function Overview
When the C Lords banished the gets() function into obscurity, cohorts of confused coders descended upon the fgets() function as a viable alternative. Alas, fgets() isn’t without its faults.
Continue reading
A Foolish Way to Read a String
Back in the old days, the obvious and logical way to read a string was to use the gets() function, where gets stands for “get string.” That makes sense, but only a hardy fool would use that function today.
Continue reading
Making Change – Solution
To solve this month’s Exercise you had to figure out a way to divvy up a dollar amount into the proper number of quarters, dimes, nickels, and pennies. As with many programming puzzles, a number of ways exist to code a solution. Click here to view mine.
Continue reading
Just Keep Asking
As you frist explore programming, you may find yourself presented with a common puzzle: How to fetch proper input from a stubborn user. The solution is something I call the Just Keep Asking loop.
Continue reading
Making Change
This month’s challenge is to calculate the number of quarters, dimes, nickels, and pennies required when given a specific dollar amount. It’s something fast food cashiers should know, but apparently they don’t! So maybe your solution to this exercise could help them.
Continue reading
The Factorial Recursion
It’s the example of recursion most often used, but it’s not the best example. Of course, to illustrate a better example you need to approach concepts such as fractals and graphical programming doodads. My favorite form of recursion is traversing a directory tree. Regardless, the code for a factorial recursion remains the go-to workhorse.
Continue reading
An Example of Recursion
A recursive function calls itself. That’s a strange and beautiful concept, one that saves a lot of coding time, but how does it really work?
Continue reading
Introduction to Recursion
It’s truly a scary thing: A function calls itself. This trick can be done without damage to the space-time continuum, and nothing explodes when it’s done correctly.
Continue reading
From Text to Integer – Solution
This month’s Exercise is to code a function that converts a string of text numbers into an integer value. If you used the skeleton provided, then your program’s output would look like this:
The string 24680 represents value 24680.