Hi I have a class where I define a

to be a private variable.Code:vector<char *> myVector

This variable will store permutations of a string

For example, if the string is "123" it will store "123","213","321" etc

I then define a function that does the permutations, the function is the following:

I have tried some debugging and realized that the variable "set" has the next permutation at position (1).Code:void PermClass::findPerms(char *set, int begin, int end){ int i; int range = end - begin; if(range == 0) myVector.push_back(set);//(1) else{ for(i=0;i<range;i++){ swap(set[begin],set[begin+i]); findPerms(set,begin+1,end); swap(set[begin],set[begin+i]); } } }

However, when the recursion ends, when I output the values of the vector by using an iterator like this:

I get as an outputCode:void PermClass::showVector(){ int i; vector<char *>::iterator it; for(it = myVector.begin(); it!=myVector.end(); it++){ cout<<*it<<endl; } cin.get(); }

can someone explain me what's wrong? thanks in advanceCode:123 123 123 123 123 123