void toText( NodePtr t, int indent ){
int i;
	for( i=0; i<indent; i++ ){ printf( "  " ); }
	if( t->left == NULL ){
		printf( "[%d]\n", t->val );
	} else {
		printf( "[%c]\n", t->val );
	}
	if( t->left != NULL ){
		toText( t->left, indent + 1 );
	}
	if( t->right != NULL ){
		toText( t->right, indent + 1 );
	}
}
	puts("");
	toText( z );
void toDot( NodePtr t ){
	printf( "N%p [label=\"", t );
	if( t->left == NULL ){
		printf( "%d\"];\n", t->val );
	} else {
		printf( "%c\"];\n", t->val );
	}
	if( t->left != NULL ){
		printf( "N%p -> N%p;\n", t, t->left );
	}
	if( t->right != NULL ){
		printf( "N%p -> N%p;\n", t, t->right );
	}
	if( t->left != NULL ){
		toDot( t->left );
	}
	if( t->right != NULL ){
		toDot( t->right );
	}
}
	printf( "\ndigraph { graph [ordering=\"out\"];\nnode [shape=\"circle\"];\nedge [arrowhead=\"none\"];\n" );
	toDot( z );
	printf( "}\n" );
dot -Tx11 hoge.dot画像ファイルとして保存したければ、次のようにする。pdf以外で保存したければ、2か所あるpdfはpngやjpgに変更すればよい。
dot -Tpdf hoge.dot > fuga.pdf自宅などで実施するのであれば、hoge.dotを以下から読み込ませる。 あるいは、hoge,dotの内容をすべて下のボックスにコピー&ペーストして、変換ボタンをクリックする。