This is an test exam question but I can't think of an correct answer.
1)What does the function mystery?
2)Why is there in the declaration of function swap(): **p and **q. explain why.
###CODE###
void mystery(char *w[], int n){
int i,j;
for (i=0;i<n;i++){
for (j=i+1; j<n; ++j){
if (strcmp(w[i],w[j]) > 0){
swap(&w[i],&w[j]);
}
}
}
}
void swap(char **p, char **q){
char *temp;
temp = *p;
*p = *q;
*q = temp;
}
Comments
Leave a comment