anagram!! problem with this code
Posted
by danielDhobbs
on Stack Overflow
See other posts from Stack Overflow
or by danielDhobbs
Published on 2010-06-07T16:38:03Z
Indexed on
2010/06/07
16:42 UTC
Read the original article
Hit count: 338
hello people!! i have a problem with this code can you fix it for me?
int anagram(char* word, int cur, int len){
int i, b = cur+1;
char temp=0;
char arrA[len];
printf("//%d**%d//", b, cur);
for (i = 0 ; i < len ; i++) {
arrA[i] = word[i];
}
for (i = cur ; i < len ; i++) {
if (b < len) {
printf("%s\n", arrA);
temp = arrA[cur];
arrA[cur] = arrA[b];
arrA[b] = temp;
b++;
}
else if (b == len)
anagram(arrA, b, len);
}
return 0;
}
© Stack Overflow or respective owner