How to Initialize arrays of NSString?
NSArray *array = @[@"foo",@"bar"];
C way:
NSString *s1, *s2; NSString *cArray[]={s1, s2};
The size of the cArray is 2, defined by the compiler.
More info here: How to initialize all members of an array to the same value?NSArray (Objective-C) way:
NSArray *objCArray = [NSArray arrayWithObjects:@"1", @"2", nil];
If you are using XCode4 (LLVM4.0 compiler), now you can use NSArray literals:
NSArray *array = @[ @"1", @"2" ];
More info here: What are the details of "Objective-C Literals" mentioned in the Xcode 4.4 release notes?
NSArray *array = [NSArray arrayWithObjects:@"String1",@"String2",@"String3",nil];