function 'OUT' parameter issue

I have bit of a problem. I cannot seem to pass pointer as a return parameter to a function in a separate module.

Given a function:

void func( typeZ * ptr );

Defined in a module called A.c like:

void func( typeZ* ptr)
{
	ptr = &var;
}

Where var is native to A.c:

typeZ var;

Now given a calling process that uses this function:

func( param );

Where the param is:

typeZ *param;

Always returns with param = NULL.

I have tried this with static and volatile keywords on the param veriable, and it still does not work. I would seem that the param parameter is properly assigned, but upon exit of the function call, the param parameter vanishes???

I think this is a problem with scope. I am using VS c/c++ 6.0. What is wrong?

Thanks.

The problem is with your function and its declaration.

Try with
void func(typeZ **ptr)
{
*ptr = &var;
}

and call it with
func(&param);

It works perfectly fine here.

Yes, thank you.