Being a (mostly) self taught programmer, I am not sure what the good practices are concerning struct's and c-array's.
I know how to define a struct and arrays inside a function.
But not how to declare one of unknown length in the @interface.
Yes, there are NSMutableArray's, but these are not very convenient for things like storing matrices (or doing matrix calculations).
All help and lessons are appreciated.
PS. Unfortunately I don't have my obj-c book close by for the next several days.
I know how to define a struct and arrays inside a function.
Code:
typedef struct {
double x;
double y;
double z;
} position;
@implementation MyClass :NSObject {
-(void) test {
position somePositions[3][2] = {{{1,2,3},{3,4,5}},{{1,2,3},{3,4,5}},{{1,2,3},{3,4,5}}}
somePositions[1][2].z = 44;
//etc.
}
}
But not how to declare one of unknown length in the @interface.
Code:
@interface MyClass :NSObject {
position allpositions[]
}
Yes, there are NSMutableArray's, but these are not very convenient for things like storing matrices (or doing matrix calculations).
All help and lessons are appreciated.
PS. Unfortunately I don't have my obj-c book close by for the next several days.