A tongue-in-cheek rating system for C programmers.
(For what it’s worth, I don’t think I’ve ever used three asterisks together in one of my programs. And since I moved to C++, I’ve rarely even needed to use two. I’m always using single asterisks though. I guess I’m only a one-star programmer these days. 😉 )
You think you don’t use two asterisks, but what about this?
int main (int argc, char **argv) { … }
(Don’t tell me you use *argv[], wimp!)
Okay, I won’t tell you. 😉
I find that
char *argv[]
is a lot more natural to my way of thinking. It reads, to me, “an array of character pointers” (and since “character pointer” means the same as “string” in C, I automatically read it as “an array of C strings”).char **argv
means the same thing to the compiler, but the way I read it is “a pointer to a character pointer”… they’re only the same when you know that C (and C++) can treat a pointer the same as an array.That said, I have no problem reading that format. I just don’t write it that way.
I’m used to the other fashion, simply because I used a primitive 6502 assembler as my first non-BASIC language (am I dating myself?) which didn’t have any macro array capability but did utilize indirection and indexing for addressing, which meant I got pointers in C right away because they are just indirection with indexing features. That having been said, in spite of understanding pointers, I also rarely use more than two and more frequently one (or zero). Two is quite frequent due to
**argv
though. 🙂