Placement of the asterisk in Objective-C

There is no difference, however you should be aware that only the first “token” (so to speak) defines the type name, and the * is not part of the type name. That is to say:

NSString *aString, bString;

Creates one pointer-to-NSString, and one NSString. To get both to be pointers, do either:

NSString *aString, *bString;

or:

NSString *aString;
NSString *bString;

Leave a Comment