Length of an `int` array in Objective C

arrays, c, objective-c

Solution

There isn't anything specific to Objective-C with an array of ints. You would use the same technique as if you were using C.

sz = (sizeof foo) / (sizeof foo[0]);

Problem

I am passing an Integer array to a function. Next I want to traverse through the array. In C and C++ this worked by simply using `arrayname.length` which gave the number of elements in array. What is the way to find that in Objective-C? `[NSArrayObject length]` works for `NSArray` type but I want it for `int[]`. Not even `[XYZ count]` works (an already suggested answer) so I'm looking for another way here.

Original source

Related problems