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
Author Archives: dgookin
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
The Multi-Dimensional Array Grid
Data is is just data. Organize that data and it becomes information. When it comes to organizing data in the C language, the first tool you probably learned was the array.
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
The Month Program, Phase V
It’s all come to this: Gathering up the individual functions necessary to code a program that outputs the current month, formatted, with the proper number of days for February. Coincidentally, this post is published in February.
Continue reading
More Centering Challenges
Centering text is one of those basic things many programmer’s have to deal with. Yet once you write the function, you might forget about something I called bounds checking. After all, who would ever pass a string to a centering function where that string would be wider than the field in which it’s centered?
Continue reading