tags:

views:

95

answers:

4

How would you read this in English? My concern is with the pointer. Is that pointer associated with char or with string?

Thanks in advance!

A: 

The part in parentheses describes the type of the parameter immediately following it—in this case, a pointer to some chars.

Noah Witherspoon
iWalter
+1  A: 

it's a pointer to char parameter named string.

So:

  • char * is the type of the parameter following it
  • string is the name of the parameter (and you should refer to this one in method body)
Jack
A: 

The parameter is a C string, which is also named string.

[obj initWithName: "whatever"];

C strings are a '\0' terminated sequence of chars, and are declared as char *.

char *foo = "a C string";
NSString *bar = @"an objc string";
Lachlan Roche
A: 

string is just the name of the parameter.

The type of the parameter is a pointer to a char.

rcw3