Hey everyone!

I've been trying for a couple of days now to make a function and it's driving me crazy.

I need a function that takes a set of numbers in an array, for example:

int array[]={4,3,5,7}

and produce another array with all possible combinations of those numbers, or just print all the combinations. Like this:

4

43

45

47

435

437

457

4357

3

35

37

357

5

57

7

...not necessarily in that order.

I tried doing it with loops and it became too complex, then I tried recursion and it got even more complex. Anybody have any ideas?