i get a stack error

template <class KT, class DT>
void my_bst<KT,DT>::show_bst_structure() const
{
	my_bst_node<KT,DT>* b=root;
	show_bst_structure(b,0);
}

template <class KT, class DT>
void my_bst<KT,DT>::show_bst_structure(my_bst_node<KT,DT>*& p, int level) const
{
	int i;
	if ( root == NULL ) 
	{
		for ( i = 0; i < level; i++ )
		{
			putchar ( '\t' );
			puts ( "~" );
		}
	}
	else
	{
		if(p->left!=NULL)
		{
			show_bst_structure(root->left, level + 1 );
			for ( i = 0; i < level; i++ )
			{
				putchar ( '\t' );
				printf ( "%d\n", root->data );
			}
		}
		else if(p->right!=NULL)
		{
			show_bst_structure( root->right, level + 1 );
			for ( i = 0; i < level; i++ )
			{
				putchar ( '\t' );
				printf ( "%d\n", root->data );
			}
		}
   }

}

almost have it work!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.