#include<iostream>
using namespace std;
void Permutation(char* pstr, char* pbegin)
{
if (*pbegin == '\0')
printf("%s\n", pstr);
else
{
for (char* pch = pbegin; *pch != '\0'; ++pch)
{
char temp = *pch;
*pch = *pbegin;
*pbegin = temp;
Permutation(pstr, pbegin + 1);
temp = *pch;
*pch = *pbegin;
*pbegin = temp;
}
}
}

void Permutation(char* pstr)
{
if (pstr == NULL)
return;
Permutation(pstr, pstr);
}
int main()
{
char str[] = "abc";
Permutation(str);
system("pause");
return 0;
}