As a beginner in c++, I have encountered a problem trying to implement a structure for binary search tree. Shown below is part of my code but c++ kept reminding me that the "data member initializer is not allowed".
#include<iostream>
using namespace std;
struct BstNode{int key; BstNode*Left; BstNode*Right; BstNode*root = NULL;};
>Solution :
You simply write
BstNode *root = nullptr;
outside of the struct.