07/06/27 22:50:20
>>371 どっかの木構造を解説してるサイトにあったのをパクったやつ
typedef struct tagTree{
int no;
struct tagTree *left, *right;
}Tree;
void PrintTree(Bin *root, int depth)
{
depth++;
if (root != NULL) {
int i;
PrintTree(root->left, depth);
for (i = 0; i < depth; i++)
printf(" ");
printf("%3d\n", root->no);
PrintTree(root->right, depth);
}
}
mainで呼ぶときはdepthを0にすればおk