所以,我正在制作一个程序,对具有三个值作为其成员的艺术家列表进行排序。但每次我编译,我都会得到标题错误。我正在施展,并且不明白为什么会发生这种情况。
struct artist *sort_artists(struct play *artistl, int criterion){
if (!(criterion == PLAYCOUNT || criterion == ARTISTID)){
printf("[ERROR]: Incorrect Criterion");
return (struct artist *)artistl;
}
else{
if (criterion == PLAYCOUNT){
struct artist *m = NULL;
struct artist *x = NULL;
struct artist *y = NULL;
if (artistl == NULL || artistl->next == NULL)
return (struct artist *)artistl;
x = (struct artist *)artistl;
m = find_middle_artist((struct artist *)artistl);
y = m;
m->next = NULL;
return merge(sort_artists(x, criterion), sort_artists(y, criterion));
}
else if (criterion == ARTISTID){
struct artist *m = NULL;
struct artist *x = NULL;
struct artist *y = NULL;
if (artistl == NULL || artistl->next == NULL)
return (struct artist *)artistl;
x = (struct artist *)artistl;
m = find_middle_artist(artistl);
y = m;
m->next = NULL;
return merge(sort_artists(x, criterion), sort_artists(y, criterion));
}
} }