I have made these two functions that find if any AVL tree contains a string that starts with 'a':
int check2( int x, AVLNode T )
{
if(x == 1)
return 0;
if( T != NULL )
{
x += check2( x, T->Right );
if(T->Word[0] == 'a')
x++;
x += check2( x, T->Left );
}
return x;
}
int check( AVLNode T )
{
return check2( 0, T );
}
where AVL is here
typedef struct node* AVLNode;
struct node
{
char Word[MAX_WORD_SIZE];
AVLNode Left;
AVLNode Right;
};
Everything works perfectly fine, but I'm using check(T); only to call check2(0, T); and pass 0 to it, is there any way to use check() only, instead of calling a function that calls another function only to pass 0 initially?