I am trying to send c-style array of integers to objective-c method, but in method I recieve only first element of array.
This is an example:
int a[3];
a[0] = 111; a[1] = 222; a[2] = 333;
[self getMatrix:a];
then
-(void)getMatrix:(int[3])matrix
{
return; -- breakpoint here
}
So, when debugging stops at breakpoint, i have matrix:
matrix int * 0xbfffddd4
*matrix int 111
Where are other elements?
So, 2d-arrays become to 1d array, 3d-array become 2d-array etc.
What I am doing wrong?
Thanks!
P.S. NSArray is working fine ofc, but I can’t imagine how to work with multidimensional (3d, 4d) NSArrays w/o writing tonns of code.
You will see that the values are correct. There is nothing wrong. The debugger is only showing
*matrixwhich is the first element. Herematrixitself is a pointer to integer orint *.