This is a good question for our Gamestudio quiz: Why can't this code work?

A hint for finding out yourself - run this program:

void main()
{
int i = 0;
long ptr1 = &i;
wait(1);
long ptr2 = &i;
printf("%d %d",ptr1,ptr2);
}

You're passing the address of a local variable to your function. But in C/C++, local variables have no fixed adresses. They are stored on the stack. That is a temporary area in the computer memory that's shared by all functions. While local variable content is preserved by wait(), they sit in a different place on the stack every frame, and have different addresses.

If you want a variable to be on an absolute address and not on the stack, use the 'static' modifier. You can read more about 'static' in a C/C++ book or tutorial.