LENGTHEXPR(3)

NAME
lengthExpr - returns the number of arguments in an expression

SYNOPSYS
#include "logmmm.h"
int lengthExpr(expr)
chain_list *expr;

PARAMETER

expr
    expression

DESCRIPTION
lengthExpr() returns the number of arguments of expr of the first level. If expr is an atomic expression, the function returns 1.

EXAMPLE
#include "mutnnn.h"		/* mbk utilities */
#include "logmmm.h"
chain_list *expr;
expr = createExpr(OR);
addQExpr(expr,createAtom("a"));
addQExpr(expr,createAtom("b"));
printf("%d",lengthExpr(expr));
/* it will display
2
*/
freeExpr(expr);

PROGRAM
int lengthExpr(expr)
chain_list *expr;
{
if (ATOM(expr))
   return(1)
else
   {
   int cpt = 0;
   while (expr = CDR(expr)) cpt++;
   return(cpt);
   }
}

SEE ALSO
log(1), abl(1), profExpr(3), numberAtomExpr(3), equalExpr(3), equalVarExpr(3), searchExpr(3), searchOperExpr(3).