Estoy haciendo un ejercicio y tengo un error al compilar.
Me piden una función recursiva que evalue boolean si un binario es avl .
Mi duda es : ¿Compilando con g++ no tendría que el circuito corto evitar el error NULL used in arithmetic ? Copio el código y agradezco ayuda.
#include <stddef.h>
#include <stdio.h>
#include <math.h>
struct nodoABB
{
int dato;
int h;//altura
nodoABB* izq;
nodoABB* der;
};
typedef nodoABB* ABB;
//recursiva chequear balanceo
bool balanceado (ABB t)
{
bool bal=true; //valor de null
if (t!=NULL)
{
bal=balanceado(t->izq) && balanceado(t->der) && (t->izq->h ==NULL || t->der->h==NULL || (abs(t->izq->h - t->der->h)<2) );
}
return bal;
}