@Dharm: Now, I wanted to shift the array by one element i.e. typically in C we do (*p)++ as described in this tutorial, but this gives errors in Xcode and it fails to compile.
You can't manually increment the pointer, which is by design. Cocoa supports both NSArray objects and the regular C-style arrays (but Cocoa methods rarely create C-style arrays). NSArrays are much safer to use, partially because they don't let you do things like that.
If you want to create a C-style buffer from an NSArray, you can use NSArray's -getObjects: method. That said, I'd strongly encourage you to reconsider your design before doing that because it's generally bad practice for Cocoa and is not required in most cases. NSArray is incredibly fast, so you really shouldn't need to work about performance in most cases.
by Scott Stevenson — Jun 12
You can't manually increment the pointer, which is by design. Cocoa supports both NSArray objects and the regular C-style arrays (but Cocoa methods rarely create C-style arrays). NSArrays are much safer to use, partially because they don't let you do things like that.
If you want to create a C-style buffer from an NSArray, you can use NSArray's -getObjects: method. That said, I'd strongly encourage you to reconsider your design before doing that because it's generally bad practice for Cocoa and is not required in most cases. NSArray is incredibly fast, so you really shouldn't need to work about performance in most cases.