[C] Implementation of binary tree with inorder traversal including special output parameters

Binary tree is implemented via pointers. It allows user input of binary tree with character based names of the root and children. It will ask for the name of left children until user terminates it with zero (0). After that, implementation will proceed recursively upwards, asking for names of right children aplying the same procedures.

After the user inputs the whole binary tree, algorithm proceeds with inorder traversal. However, the output is formatted so it wouldn't print the children in the binary tree. Example:

               A

             /   \

            B     C

           /     /

          F      D

           \       \

            J       E

                   / \

                  G   H



Inorder traversal: F J B A D G E H C 

Inorder traversal *without children*: F B A D E C 

Source

btree.w.inorder.c

Program successfully compiles under:

  • [x86]gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
  • [x86]Mingw/GCC 3.4.2
  • [x86]gcc version 3.3 [Win XP]
  • [IA64]gcc version 4.1.2 ia64-hp-hpux11.23
  • [m68k]gcc version 2.95.3 20010125 (prerelease, propolice)
  • [powerpc]gcc version 2.95.3 19991030 (prerelease)