Try defining your function like so:
void initFoo(foo **tmp)
{
...
*tmp = malloc(sizeof(foo) * 5);
...
}
and pass the pointer like so
foo *bar = NULL; /* want to create an array of 5 */
initFoo(&bar);
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387