void sort(struct node **s2) {
struct node *x, *y;
x = *s2;
char *str;
while (x != NULL) {
y = x->n;
while (y != NULL) {
if (strcmp(x->name, y->name) > 0) {
strcpy(str, x->name);
strcpy(x->name, y->name);
strcpy(y->name, str);
}
y = y->n;
}
x = x->n;
}
}
This is showing a run time error. I don't know whats wrong I believe the sorting is correct It's selection sort The structure of my node is:
struct node {
char *name;
struct node *n;
};
It's showing runtime error.
}