vendredi 6 mars 2015

C pointer address is very strange


Vote count:

0




sorry for my poor English, I have written the C code for Splaying tree, but when I put the "Find()" operation in main function, I couldn't initialize the Tree, that is, without the line "Find()" , using GDB, I found the my_tree's value is 0x0 when breakpoint in line "MakeEmpty", but add the line "Find", the value is 0x7fffffffbeb0. I know the Find() function has problem, but I don't understand why the latter statements infect the former statement?



#include<stdio.h>
#include "SPTree.c"

void main()
{
Position my_tree;

my_tree = MakeEmpty( my_tree );

my_tree = Insert( 5, my_tree );
my_tree = Insert( 6, my_tree );

Position P = Find( 5, &my_tree );
}


asked 54 secs ago







C pointer address is very strange

Aucun commentaire:

Enregistrer un commentaire