For an argument, functions in the C language can take literal values, equations, the result from another function, or any combination of these items. It’s a feature that’s both flexible and confusing.
Continue reading
Category Archives: Lesson
How a for Loop Works
I received an interesting question the other day. A student asked me to explain a for loop. Dutifully, I set out and gave my description, which he found entirely baffling. So I backed up again and gave this explanation:
Continue reading
ASCII Programming Tricks, Round II
You probably don’t even think about it. How do the toupper() and tolower() functions do their magic? Both functions take a letter of one case and convert it to the same letter of the opposite case. They don’t touch any other characters or symbols.
Well, how would you code it?
Continue reading
ASCII Programming Tricks, Round I
The clever organization of ASCII character codes lends itself to some useful programming tricks. One of those tricks involves converting from character codes ‘0’ through ‘9’ to integer values zero through nine.
Continue reading
ASCII Character Codes
ASCII refers to character codes from zero through 127. These codes are interpreted identically on all modern computers. They represent basic alphabetic, numeric, and symbol characters.
Continue reading
Name Your Variables
As you sit and madly pound out code, variable names are probably not at the top of your list of things to do better. I tend to use x for my loops, c or ch for characters, and other variables, including a, b, and c. This is an acceptable approach, but for larger programs such variable names not doing you any favors.
Continue reading
A Few Pointers on Structure Pointers
Structures aren’t really scary. Pointers are scary. Obviously, a good way to make structures more terrifying it so throw some pointers at them.
Continue reading
Struc(Structures)tures
A structure is capable of containing any other type of C language variable. That includes other structures.
Continue reading
Breaking Down Structures
In the C language, struct is a variable type, but do you declare a structure or define a structure? That one has me perplexed.
Continue reading
Lovely, Weird Assignment Operators
Some programmers find it charming that C can be so frustratingly obscure. In fact, a lot of the language’s perplexing nature is simply a reflection of its efficiency.
Continue reading