Why is there space before and after * in const char * argv[]


#1

The title says it all: Why is there space before and after * in const char * argv[]? Why not const char *argv[]?


#2

The space doesn’t matter at all to the compiler, so the question might be “Which is prettier?”

In general, I tend to put a space before the star, and not after:

But, the template has a space before and after, so I guess Apple thinks it is prettier that way:


#3

Got it. – Thanks very much for your help, Aaron.

I’m really loving your book! I’ve tried a couple of other Objective-C books in the past, but pointers always confused me. You’re explanation was the first that really made sense.

Thanks again,

: )

J


#4

The * is not part of the name, nor type, but a descrete modifier (modifying the type of variable to be a pointer).
I prefer to use “type * name” but “type* name” and “type *name” are all legal and acceptable.