Added options (display, tree type...)
This commit is contained in:
9
oper.c
9
oper.c
@@ -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);
|
||||
|
Reference in New Issue
Block a user