开发者

Objective - C -> Pass Array As Function Argument

开发者 https://www.devze.com 2023-03-19 09:55 出处:网络
Is it poss开发者_开发技巧ible to pass an array as an argument for a function?Yes, of course. C-array:

Is it poss开发者_开发技巧ible to pass an array as an argument for a function?


Yes, of course.

C-array:

- (void)myFunction:(int*)array;
 ...

int bar[12];
[obj myFunction:bar];

NSArray:

- (void)myFunctionWithNSArray:(NSArray*)array;
...
NSArray *array = [[NSArray alloc] initWithObjects...];
[obj myFunctionWithNSArray:array];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号