Re: How to store C Arrays as a Property or iVar?
Pascal Bourguignon
Objective-C is C. You have to know C to be able to program in Objective-C. In C, arrays are not first class objects. So you cannot use = to copy arrays (or to take a reference to an array, there’s no such notion in C). The solution is to write a loop to copy the elements. void copy_my_array(int src[10][10],int dst[10][10]){ for(int i=0;i<10;++i){ for(int j=0;j<10;++j){ dst[i][j]=src[i][j];}}} then use: copy_my_array(myArray,_myArray); -- __Pascal J. Bourguignon__ |
|