C Arrays

Using C Arrays


	UInt8 MyArray[10];
	MyArray[0] = 0x00;
	MyArray[1] = 0x01;

	int LengthOfMyArray = length:sizeof(MyArray);

Const Static Arrays

Create your array of values, in your .m file or before the @interface in your .h file, like this:

(more…)

Sorting Arrays

Basic Array Sort In Ascending Order


	[SomeArrayName sortUsingSelector:@selector(compare:)];

 (more...)

Using Arrays

Arrays in Objective-C do not contain the objects that belong to it, they hold a pointer (reference) to each object in the array.  So when you use :addObject you are simply storing the address of that object inside the array. This means that you can have different types in a single array.  This is a key difference to other languages where an array can only hold 1 object type. (more…)