Allocated memory address clash
Posted
by Louis
on Stack Overflow
See other posts from Stack Overflow
or by Louis
Published on 2010-04-12T19:15:53Z
Indexed on
2010/04/12
19:22 UTC
Read the original article
Hit count: 392
Hi, i don't understand how this happen. This is portion of my code..
int isGoal(Node *node, int startNode){
int i;
.
.
}
When i debug this using gdb i found out that 'i' was allocated at the memory address that have been previously allocated.
(gdb)print &node->path->next
$26 = (struct intNode **) 0xffbff2f0
(gdb) print &i
$22 = (int *) 0xffbff2f0
node->path->next has been already defined outside this function. But as u can see they share the same address which at some point make the pointer point to another place when the i counter is changed.
I compiled it using gcc on solaris platform Any helps would be really appreciated..
© Stack Overflow or respective owner