unsafe public class Temp
{
public struct Node
{
Node *left;
Node *right;
int value;
}
public Temp()
{
Node* T=new Node();
T->left=null;
T->right=null;
T->value=10;
}
}
main()
{
Temp temp=new Temp();
}
It gives error that Object reference not set to instance of an object. How can I do it when I want to make AVL Tree Program(which I have created and tested in C++ but copying in C# gives error)
unsafe? Copying code from C++ is not going to get you very far. Are you sure you don't want aclass(in C#, this means reference type, which allowsnullvalues) instead of astruct(in C#, this means value type, which is always copied by value and has no concept ofnull)?