You might think that the command line is a relic of the past. For a mortal user, that’s correct: The only people I know who still dwell at the command prompt are power users. I keep a command prompt (terminal) window open on my computers, just because using the terminal is fast and I happen to know the commands. Yet, internally, all graphical operating systems still reference the command line.
Continue reading
Category Archives: Lesson
Manually Allocating a Pointer Array
A few Lessons ago, I mentioned that a variable such as **months couldn’t be used to declare an array. That’s true because the **months construction doesn’t use array notation. Duh. That doesn’t mean that **months is totally out of luck.
Continue reading
Direct String Manipulation
As programmer, you have a choice: You can manipulate information as it’s sent to output or you can manipulate it in memory and then send the result to output. Depending on what the program does, however, you may not have that luxury. Sometimes you must make modifications in memory, saving them for later.
Continue reading
The Art of String Manipulation: Spaces to Newlines
The C language lacks a sack of tools for manipulating strings. For most string-mangling operations, you’re pretty much left to carve out your own tools. Doing so may involve pointers, but it doesn’t necessarily have to.
Continue reading
Getting Shifty
Something that you can do in the C language that C++ programmers cannot is employ the shift operators. These operators, << and >>, serve as I/O operators in C++. In C, however, they can be used to manipulate values at the bit level in C, which is part of the C language’s mid-level heritage.
Continue reading
Splitting Things in Half
It’s pretty safe to avoid your first instinct when it comes to dividing two integers. That first instinct is most likely to typecast the int values as float. That works, and many times it can be the best solution, but it’s not always the solution.
Continue reading
Of Course, ****d is a Variable
The unary * operator is used both to declare a pointer and access the value at that pointer’s location. When the value is the address of another pointer, two * unary operators are used. When the value is the address of an address of an address of an address, then four * unary operators are used. I kid you not.
Continue reading
How the ** Pointer Variable Works Best
The pointer-to-a-pointer variable does have a purpose, but fortunately it’s a very specific and rare purpose. And, no, that purpose isn’t to make you wish you had learned to program in Java.
Continue reading
The Ongoing Mystery of the ** Variable
The ** notation can really make a beginning C programmer blanch. In fact, a lot of Java programmers probably fled from the C language just after the initial lesson on pointers. They’d turn to stone even to glance at a variable like **blorf. You don’t need to cower under a desk with those people.
Continue reading
An Array of Pointers
Here’s a scary thing for most people: **blorf. No, not the name blorf, although it’s one of my favorite made-up words. What drives programmers insane — and all programmers, not just C programmers — are those double disaster asterisks.
Continue reading