0
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
end ), but if I remove the return NULL
from the end it points out that the function is not getting back; so if I let it return NULL
it breaks the address I get inside the else
... how to solve ?
Vlw, I understood what I was doing wrong, the problem of not checking the first knot was on the face and still ... ( In addition to the problem I was creating with Return; how to use the functions is better than doing the comparisons I’m doing type ! ( ) ) - Refactored : Codeshare.io/5zEBz7
– Luis Souza