gpt4 book ai didi

objective-c - 目标 - C -> 将数组作为函数参数传递

转载 作者:太空狗 更新时间:2023-10-30 03:46:55 26 4
gpt4 key购买 nike

是否可以将数组作为参数传递给函数?

最佳答案

当然可以。

C 数组:

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

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

NS数组:

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

关于objective-c - 目标 - C -> 将数组作为函数参数传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6628461/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com