#include "stdafx.h"
#include <iostream>
#include <cstdlib>
using namespace std;
struct BST_N
{
int val=0;
BST_N* prev=NULL;
BST_N* right = NULL;
BST_N* left = NULL;
} *root = NULL;
void insert(BST_N* &root, BST_N* &x);
int main()
{
BST_N *x=NULL, *p=NULL;
x->val = 18; // tutaj wystepuje problem
p->val = 13;
insert(root, x);
insert(root, p);
cout << root->val << endl;
cout << root->left->val << endl;
system("pause");
return 0;
}
Witajcie
Mam niezrozumiały dla mnie problem. Program wysypuje się w 18 linii. Przecież przypisuje wartość do val, które jest intem.