game_object *items[1000];
foo()
{
insert(items[0]);
}
File 2
struct node
{
game_objects *inserted[5];
int numObj=0;
};
//Node is properly initialized, memory is allocated
void insert(game_object* &toInsert)
{
tst->inserted[0] = toInsert;
printf("%d %d",toInsert->x,toInsert->y);
}
When I try to acess toInsert (via the printf) the program crashes. For some reason tst->inserted[0] does not point to the same address as items[0] (which is what I want). Maybe I''ll figure it out in the morning, but I always get these stupid pointer things wrong. Any help is appreciated.