
Random char Array
Dear all,
i want to randomize the numbers of a char array, like:
if a have a number 1234. With the function itoa i will have an array like this:
a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 4;
This work fine. Now i want to generate ALL new integers which are made of these values:
1234, 1243, 1324, 1342, 1423, 1432
2134, 2143, 2314, 2341, 2413, 2431
3124, 3142, 3214, 3241, 3412, 3421
4123, 3132, 4213, 4231, 4312, 4321
Do you have an idea how to do this?
Regards

I have some ideas, but I REALLY want to see what solution you were thinking about; some pseudocode will be fine. :)

if i think in the way as i as a human did:
1. start with low to hight (element1element2element3element4)
2. element 1 & element 2 stays the same, interchange element 3 & element 4
3. element 1 & element 3, put element 3 & element 4
4. element 1 & element 3, interchange element 3 & element 4
5. element 1 & element 4, put element 3 and element 4
6. element 1 & element 4, interchange element 3 & element 4
7. element 2 & element 1, put element 3 & element 4
8. element 2 & element 1, interchange 3 & element 4
9. element 2 & element 3, put element 1 & element 4
10. element 2 & element 3, interchange 1 & element 4
11. element 2 & element 4, put element 1 & element 3
12. element 2 & element 4, interchange 1 & element 3
and keep going like this

So you have a set of 4 elements (1, 2, 3, 4) and you need to find all of it's permutations?
Have fun googling "c permutations". :)