[CPP]View Plaincopyprint?
- Nsmutablearray *arr = [[Nsmutablearray alloc] init];
- For (int i = 0; i < i++) {
- [Arr addobject:[nsstring stringwithformat:@"damo%d", I]];
- }
- NSLog (@"%@", arr);
- Nsmutablearray *bigarr = [[Nsmutablearray alloc] initwithcapacity:1];
- Nsmutablearray *smallarr = nil;
- For (int i = 0; i < [arr count]; i++) {
- if (i% 3 = = 0) {
- //Just read 0 3 6 9 12 to open up space to store the next three elements
- Smallarr = [[Nsmutablearray alloc] initwithcapacity:1];
- //Add a decimal group to a large array for management
- [Bigarr Addobject:smallarr];
- }
- [Smallarr Addobject:[arr objectatindex:i];
- }
- NSLog (@"%@", Bigarr);</span>
2 has an array with 13 elements in the array, first grouping the array, each of the 3 elements as a group, divided into groups, and finally using an array to manage these groupings uniformly. (To create an array dynamically).