Print all the possible permutations of a character string.
Sigiloso
void swap(int *x, int *y) { *x = *x ^ *y; *y = *y ^ *x; *x = *x ^ *y; } void permute(int n, char *s) { if(n == 0) { printf("%s\n",s); return; } for(i = n; i >= 0; --i) { swap(s[i],s[n-1]); permute(n-1, s); swap(s[i], s[n-1]); } return; }