0

これは私の構造体とメソッドですが、機能していません。誰でも問題がどこにあるのか教えてもらえますか? ありがとう

これは構造体です:

    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;
    }
}
4

1 に答える 1