Hello,
i was trying to generate a series as follows:
111
112
113
121
122
123
131
132
133
and this is what i tried:
#include <stdio.h>
int A[3];
void func(int k)
{
static int level = -1;
A[++level] = k;
for(int j = 1; j <= 3; j++) {
if(level < 3) {
func(j);
} else {
for(int i = 0; i < 3; i++) {
printf("%d", A[i]);
}
}
printf("\n");
//getchar();
}
--level;
}
int main(void)
{
func(1);
getchar();
return 0;
}