我怎么能做到这一点:
char sXSongs[20][30] = {"Song 1", "Song 2 (w/Blur)", "The End (It's Not Here Yet)"};
addAlbum(&list, "The Beatles", "Some Famous CD", 1960, sXSongs);
但不是这个:
addAlbum(&list, "The Beatles", "Some Famous CD", 1960, {"Song 1", "Song 2 (w/Blur)", "The End (It's Not Here Yet)"});
是否无法在函数调用中初始化 cstrings 数组?
以下是一些其他信息:
album* list = NULL;
typedef struct album {
char performer[20];
char CDtitle[50];
int year;
char songs[20][30];
struct album* prev;
struct album* next;
} album;
最佳答案
没有。可以在声明数组时对其进行初始化,否则不行。
关于c - 在函数调用中初始化 cstring 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2271874/