这是我的结构和方法,但它不起作用。谁能帮我解决问题在哪里?谢谢
这是结构:
struct album
{
char singerName[30];
char year[4];
char title[30];
char songName[50];
char songLength[50];
struct album *next;
};
struct album *a=NULL;
这是方法:
struct album *addAlbum(struct album *list,char* year,char *title,char *singerName)
{
struct album *temp;
temp =(struct album*) malloc(sizeof(struct album));
strcpy(temp->singerName,singerName);
strcpy(temp->title,title);
strcpy(temp->year,year);
temp -> next = NULL;
if(list==NULL)
{
return temp;
}
else
{
temp->next=list;
return temp;
}
}