C (101/304)

From:Niels de Koning
Date:13 Aug 2000 at 08:10:11
Subject:Passing a ptr

> It works fine as is but I when I place it in a function and call that
> function, it doesn't work at all. I know it is how I am declaring
> the args but I can't figure it out. Given a funtion name of
> Makearray I tried MakeArray (mystruct **array) but it didn't
> like that at all. Can someone show me the correct way of passing
> the variable array?

If you want to return a value from a function in the parameter list you
always have to add a level of indirection to that parameter, which means
there would have to be another pointer-level added in this case.

MakeArray (mystruct ***array);

void main()
{
Array **array;
MakeArray( &Array );
}

I hope this is what you meant!

// Niels de Koning
_____________________________________________________________________
Main editor on the GFXZone http://gfxzone.planet-d.net