Pointers in method params - objective-c -
How to pass the pointer as the ultimate in method? For example:
- (zero) dosomething: (NSString *) simpleString: (NSMutableArray *) Pointertoorrere; Where the simple string is the simplest, and the pointeroure is an indicator for an array;
In Objective-C, strings and arrays are both classes as you can see, they Only access through pointers, then you only use them as a declaration:
- (zero) dosomething: (NSString *) simpleString: (NSMutableArray *) PointeroOurere; And you like it:
NSString * s = @ "Hello, World"; NSMutableArray * a = [NSMutableArray arrayWithObjects: @ "hello", @ "idiot", @ "example", zero]; [YourClass dosomething: s: A];
FWIW, your method's name is dosomething :: . This is customary to denote each parameter, so I will call it: - (zero) doSomethingWithString: (NSString *) Greeting array: (NSMutableArray *) string; Then the name is doSomethingWithString: array: which is more readable, IMO invites you with it like this: [YourClass doSomethingWithString: s array: a];
Comments
Post a Comment