Witam,
Bardzo proszę o pomoc w zrozumieniu problemu.
Dlaczego adres przechowywany przez wskaznik root, przed i po wyjsciu z funkcji ma wartosc 0, a nie taki sam w funkcji insert i po wyjściu z niej.
#include<iostream>
using namespace std;
struct node
{
int value;
node * left;
node * right;
};
node* global = new node();
void insert(node* tree,int arg)
{
if(tree==NULL)
{
tree = global;
tree->left=NULL;
tree->right=NULL;
tree->value=arg;
cout << tree << endl;
}
}
int main()
{
node* root=NULL;
cout << root << endl;
insert(root,1);
cout << root << endl;
system("pause");
return 0;
}