Hi All,
I want to write a func to generate all the permutations of L[1,2,3,4], once at a time and output it in an array...
For example, the first time the func called, it outputs a pointer to L[4]={1,2,3,4};
the second time the func called, it outputs a pointer to L[4]=[1,3,2,4];
...
...
the 4! time the func called, it outputs a pointer to L[4]={4,3,2,1];

Could anyone give me an idea like how to write the code generating an array like this?
My guess is to use some kinds of static variable in the function so it could keep its value after one execution of the function and guide the next execution to generate a different ordering.

Thanks in advance.