You should pass the structures by reference, not by value. That means passing a pointer to the structure. I don't know what InitArray() does or returns, but I assume it returns a pointer. Here is how you need to write the first function you posted. Do something similar with the other functions.
Do not use reserved words as variable names. struct is a reserved word.
void function(Struct* str, int i, int k)
{
str->array[i] = InitArray();
str->array[i]->key = k;
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343