Compared to other programming languages, C is weak when it comes to dealing with arrays. The array has a starting point and a variable type. That’s pretty much it. Your code determines where the array ends. That type of programming discipline terrifies coders of other languages.
Continue reading
Author Archives: dgookin
Just Average – Solution
If you attempted to compile the code skeleton for this month’s Exercise, you most likely stumbled across the first problem to solve: The average() function requires a type.
Continue reading
The getline() Function
The latest and most trendy function for reading a string of text is getline(). It’s a new C library function, having appeared around 2010 or so.
Continue reading
Just Average
Among the tools missing from the C library, which are ample in other programming languages, are functions that manipulate arrays. I’ve seen functions in other programming languages that slice, dice, mince, and chop an array. One of the more common functions calculates the average of a numeric array.
Continue reading
Fetching Text
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