|
|
|
4 registered members (PeWi, vince, Quad, 1 invisible),
4,489
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
pointer in a function containig wait
#472098
04/07/18 12:38
04/07/18 12:38
|
Joined: May 2008
Posts: 2,113 NRW/Germany
alibaba
OP
Expert
|
OP
Expert
Joined: May 2008
Posts: 2,113
NRW/Germany
|
It's been some time since I've used 3DGS so it might be a stupid question. (Code may contain errors since I've just typed from the top of my head)
void foo(int* i)
{
*i=5;
wait(1);
*i=6;
}
void main()
{
int a=0;
foo(&a);
wait_for(foo);
printf("%d", a);
}
This example gives me a "5" instead of a "6". Are pointers lost when using waits in a function? Is there a workaround?
|
|
|
Re: pointer in a function containig wait
[Re: Superku]
#472100
04/07/18 17:09
04/07/18 17:09
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
another workaround would be using dynamic memory allocation. still, like Superku said, avoiding wait as much as possible is probably the best way.
POTATO-MAN saves the day! - Random
|
|
|
|
|
|
|