标签:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSArray *arr=@[@"MON",@"TUE",@"WED"];
//下标遍历
1
for (int i=0; i<[arr count]; i++)
{
NSString *str=[arr objectAtIndex:i];
NSLog(@"%@",str);
}
//2
for (int i=0; i<[arr count]; i++) {
NSLog(@"%@",arr[i]);
}
//for in 遍历性高
for (NSString *str in arr ) {
NSLog(@"%@",str);
}
//id当不确定数组元素的类型时,选则使用de
for(id str in arr){
NSLog(@"%@",str);
}
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/j-h-t-123-n/p/5115656.html