void preorder_call(struct node *root, int *arr, int *index)
{
	if (root == NULL)
		return;

	arr[*index] = root->data;	(*index)++;
	preorder_call(root->left, arr, index);
	preorder_call(root->right, arr, index);
}
void preorder_call(node * root, int * arr, int * ptr){
	/*

	1. First visit data
	2. Next Left subtree
	3.Next Right subtree

	*/
	if (root == NULL)
		return;
	arr[*ptr] = root->data;
	(*ptr)++;//must increament here only to retain value in next function call
	preorder_call(root->left, arr, ptr);
	preorder_call(root->right, arr, ptr);
}
void preorder(struct node *root, int *arr){
	if (root == NULL || arr == NULL){
		return;
	}
	int ptr = 0;
	preorder_call(root, arr, &ptr);
}
void preorder(struct node *root, int *arr)
{
	if (root == NULL || arr == NULL)
		return;

	int index = 0;
	preorder_call(root, arr, &index);
}