NSString* str=@"today";
Person* p1 = [[Person alloc]init];
//nil空对象,NULL表示空类
//数组的初始化方法
NSArray *array = [[NSArray alloc]initWithObjects:@"123",str,p1, nil];
//便利构造器初始化方法
//NSArray *arr = [NSArray arrayWithObjects:@"123",str,p1, nil];
//求数组元素个数
NSUInteger count = [array count];
NSLog(@"%lu",count);
for (int i=0; i<count; i++)
{
//通过索引找元素
id object = [array objectAtIndex:i];
NSLog(@"%@",object);
}
//通过元素找索引
NSUInteger index = [array indexOfObject:p1];
NSLog(@"%lu",index);