How to access the first or specific element in CCArray?

I want to get access to the first element in CCArray. I tried to use CCARRAY_FOREACH to read the element. But, it is not efficient. Is there any function supporting this feature?

“CCObject* lastObject();” ?

Thank you for your reply. However, does last object not refer to the latest added one? What I want is the oldest element in the CCArray.

objectAtIndex(0) ?

Wing Check wrote:

Thank you for your reply. However, does last object not refer to the latest added one? What I want is the oldest element in the CCArray.

That is up to you, how you decided to order the inserts.