The code is this:
Node * search ( Node ** root, int mats ) {
if ( ! ( * root ) ) {
return NULL;
} else {
search ( & ( * root ) -> esq, mats );
if ( ( * root ) -> person.mat == mats ) {
return ( * root );
}
search ( & ( * root ) -> dir, mats );
}
// return NULL;
}
The problem is that the compiler points out that it is giving segmentation failure (I believe because of the return NULL
of the end), but if I remove the return NULL
from the end it points out that the function has no return; so if I leave it returning NULL
it breaks the address I get inside else
... how to solve?