I'm trying to write binary search tree's content to temporary array in order to use in main. However I'm not sure how to do it... I have tried something like this:
void Book::preorder(TreeNode *ptr, Person &temp[], int x)
{
if(ptr!=NULL)
{
temp[x].name=ptr->item.name;
x++;
preorder(ptr->left, temp, x);
preorder(ptr->right, temp, x);
}
}
And, it gives following errors:
declaration of 'temp'a as array of references
no match for 'operator[]' in '((Book*)this->Book::temp[x]'
no matching function for call to 'Book::preorder(TreeNode*&, Person&, int&)'