cant see why it works
ptemp=word[i];
i remember a thread of some user
that asked of ways to do a copy of an array.
and i suggested him to do this
thing.
and then i have been criticized by that "solution"
that we cant make a copy of an array just by assigning its address to other pointer
because (it cannot be copied or something like that)
Code:
int maxNum(char *str) {
int i, j, max=0, count;
for(i=0; str[i]; i++){
count=1;
for(j=i+1; str[j]; j++)
if(str[i]==str[j])
count++;
if(count >max)
max = count;
}
return max;
}
void sort(char** word, int size){
int i, j;
char *ptemp;
for(i=0; i<size-1; i++)
for(j=i+1; j<size; j++){
if(maxNum(word[i])<maxNum(word[j])||
(maxNum(word[i])==maxNum(word[j]) && strcmp(word[i], word[j])>0)){
ptemp=word[i];
word[i]=word[j];
word[j]=ptemp;
}
}
}