标签:字符串
void Permutation(char* pStr)
{
if (pStr == NULL)
return;
Permutation(pStr, pStr);
}
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;
}
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:字符串
原文地址:http://blog.csdn.net/wangfengfan1/article/details/46817491