I read about this for a while, and I'm not sure I found a good answer.
I am trying to tune an array of 92 structures. This is a fixed length and will not change how efficient the lookup table is. I thought the best way to do this is to first allocate the memory using calloc and then load the data.
But after some reading, I see that many people allocate memory directly without calloc or malloc , like this
myStruct myData[92] = { {1,2}, {3,4}, ....};
My first question is: is it better to dynamically allocate memory? I realized that this is the best solution. Especially if the data is not necessarily used all the time.
My second question is about data initialization. I read that I can initialize the structure using ... = {....}; but the compiler does not accept this.
Here is the code that I still have:
typedef struct { int a; int b; } myStruct; @implementation MyClass static myStruct *myData; -(id) init {
source share