How can I find the permutations of k in a given length?
For example:
The word cat has 3 letters: How can I find all the permutations of 2 in the
cat
void Prem (char *str, int k, int length) { if (k == length-1){ printf("%s\n",str); return; } else { for (int i = k ; i < length; ++i) { char t = str[k]; str[k] = str[i]; str[i] = t; Prem(str,k+1,length); t = str[k]; str[k] = str[i]; str[i] = t; } } }