C语言 如何将二叉树中序遍历的结果存入数组

C语言 如何将二叉树中序遍历的结果存入一个数组,我的代码这段是用递归写的,但不知道如何将值传到数组中?

 void treeprint(struct tnode *p)
{
    if(p!=NULL){
        treeprint(p->left);
        printf("%s %d\n",p->word,p->count);
        treeprint(p->right);
    }
}

我的想法是将每个p->word (指的是单词)存入二维字符型数组中
将每个p->count(指的是单词的个数)存入整型数组中,但不知道如何将值传到数组中?

 最简单的,先开一个很大的数组(确保肯定够)tnode * arr[100000],再定义一个全局的变量  int currindex
printf("%s %d\n",p->word,p->count);
->
arr[currindex++] = p;

全局变量是魔鬼,少用,
其次我也在想怎么存