Originally Posted by

**sean_mackrory**
What isn't working now? You need to be more specific about that so we know where to look.

ok...

when u run the above code, u get this result:

Code:

$ ./test.out
Enter a number between 1 and 16: 1
a
b
c
d
$ ./test.out
Enter a number between 1 and 16: 2
a
b
c
d
a
a
b
c
d
b
a
b
c
d
c
a
b
c
d
d

here is the full code:

Code:

#include <stdio.h>
void f(int, int, int);
int main(void)
{
int x = 0, num;
printf("Enter a number between 1 and 16: ");
scanf("%d", &num);
if (num < 1 || num > 16)
printf("-> %d is not a valid number.\n", num);
else
f(x, num, num);
}
void f(int x, int n, int num)
{
int i;
char a[4] = {'a', 'b', 'c', 'd'};
char temp[16];
if(num == 0)
return;
else
for(i = 0; i < 4; i++)
{
temp[x] = a[i];
f(x + 1, n, num - 1); // here?
temp[x + 1] = '\0';
printf("%s\n", temp); // and maybe here?
}
}