This shows you the differences between two versions of the page.
objective-c:foundation.framework:nsarray.h:init [2014/05/30 21:39] 93.219.3.186 |
objective-c:foundation.framework:nsarray.h:init [2024/02/16 01:12] (current) |
||
---|---|---|---|
Line 17: | Line 17: | ||
<code objc> | <code objc> | ||
- | // ** Init array | + | // ** Init array ** |
NSArray *myArray = [[NSArray alloc]init]; | NSArray *myArray = [[NSArray alloc]init]; | ||
- | // ** Output array | + | // ** Output array ** |
NSLog(@"myArray: %@", myArray); | NSLog(@"myArray: %@", myArray); | ||
</code> | </code> | ||
+ | If you look at the output for this example code, you`ll see that an empty array was initialized! Because this array is immutable it would make more sense to use a init-method that creates it with some objects or at least one object. For example [[objective-c:foundation.framework:nsarray.h:initwithobjects|]]. | ||
==== Output for this example code ==== | ==== Output for this example code ==== |