在列中打印 AVL 树

Print AVL tree in columns

我正在用 C 实现 AVL 树,我想在控制台的三列中打印树的所有元素。

我有这个:

void printInOrder(nodo * raiz) {
    if (raiz != NULL) {
        printInOrder(raiz->esq);
        printf("%s\n", raiz->codigo);
        printInOrder(raiz->dir);
    }
}

有人知道如何打印三列输出吗?

这就是我要搜索的内容:

int printInOrder(nodo *root, int count){
if(root!=NULL){
    count=printInOrder(root->left,count);
    count++;
    if(count%PRINT_COLS==0 && count!=0) printf("%s \n", root->code);
    else printf("%s \t\t", root->code);
    if(count%(2*10*PRINT_COLS)==0 && count!=0){getch();}
    count=printInOrder(root->right, count);
}
return count;

}