// .cpp :
//
#include "stdafx.h"
#include "string.h"
void fun(char* pstr, int len)
{
char* ptmp = new char[len+1];
printf("%s\n\n", pstr);
for(int i=0;i<len; i++)
{
strcpy(ptmp, pstr);
for(int j=i+1; j<len; j++)
{
char c = ptmp[i];
ptmp[i] = ptmp[j];
ptmp[j] = c;
printf("%s\n", ptmp);
}
printf("\n");
}
}
char* p = "abcde";
int _tmain(int argc, _TCHAR* argv[])
{
fun(p, strlen(p));
getchar();
return 0;
}