Added options (display, tree type...)

This commit is contained in:
2021-01-25 14:59:32 +01:00
parent 804aa7d6b5
commit cfde68dd96
6 changed files with 184 additions and 74 deletions

9
oper.c
View File

@@ -44,6 +44,9 @@ static char *combine(ops, len, n)
if (!res) { // 1st call
len_ops=strlen(ops);
# ifdef DEBUG_MEM
printf("mem: allocating operators working area (%d bytes)\n", len+1);
# endif
res=malloc(len * sizeof(char) + 1);
}
for(i=0; i<len; ++i){
@@ -59,7 +62,9 @@ void gen_combinations(nops)
char *ops="+-*/";
int i, n_combs;
int len_ops=strlen(ops);
# ifdef DEBUG_OPER
printf("gen_combinations(%d)\n", nops);
# endif
n_combs=n_combine(len_ops, nops);
//printf("gen: n=%d\n", n_combs);
for (i=0; i<n_combs; ++i) {
@@ -84,7 +89,7 @@ int main(ac, av)
{
char *ops="+-*/", *p;
int len_ops=strlen(ops);
int i, j, nops, ncombs;
int i, nops, ncombs;
nops=atoi(*(av+1));
ncombs=n_combine(len_ops, nops);