Вы правы, что проблема связана с указателем на указатель в bstlist_add
. Вот пример, который должен помочь вам понять, что вам нужно изменить в своем коде.
int a=10;
int b=20;
void noChange(int * pSomeInt);
void change(int ** ppSomeInt);
int main(int argc,char * argv[])
{
int * pMainInt=&a;
noChange(pMainInt);
//pMainInt will still point to a
//since the parameter to change is int **, we have to use & here
change(&pMainInt);
//pMainInt now points to b
return 0;
}
void noChange(int * pSomeInt)
{
//while pSomeInt is a pointer, it is a copy of pMainInt, not a pointer to it
//so this creates a pointer to the parameter, pSomeInt, itself
int ** ppSomeInt=&pSomeInt;
//so this changes the parameter, pSomeInt
*ppSomeInt=&b;
}
void change(int ** ppSomeInt)
{
//ppSomeInt is a pointer to pMainInt, which is itself an int *
//so *ppSomeInt is pMainInt and not a copy of it
*ppSomeInt=&b;
}