Hi I have a BST binary search tree
typedef struct Treenode *SearchTree;
struct Treenode
{
int Element;
SearchTree Left;
SearchTree Right;
};
and I want to create a function
FillArray(int sizeoftree, tree, int array[])
And I want to use an array and copy the nodes of the tree in the array. How can I do this? the following code does not work. I tried:
int FillArray(int a,SearchTree T,int arr[])
{
if (T==NULL)
{
return 0;
}
else
{
FillArray(a,T->Left,arr);
arr[a]=T->Element;
a++;
FillArray(a,T->Right,arr);
}
}