int main(int argc, const char**argv)
{
NSArray *arr = @[@1, @2, @3, @4, @5, @6];
NSMutableArray *mArr = @[].mutableCopy;
reversArray(arr, 0, &mArr);
}
// 逆序数组
void reversArray(NSArray *arr, int begin, NSMutableArray **results)
{
if (arr == nil || begin >= arr.count) {
return;
}
reversArray(arr, begin, results);
if (results) {
[*results addObject:arr[begin]];
}
}
网友评论