在 C 中,我需要静态预分配一个数字数组,每个数字都与不同的字符串数组相关联。像下面这样的代码是否可以解决问题:
struct number_and_strings {
int nnn;
char **sss;
}
static struct number_and_strings my_list[] = {
{12, {"apple","banana","peach","apricot","orange",NULL}},
{34, {"tomato","cucumber",NULL}},
{5, {"bread","butter","cheese",NULL}},
{79, {"water",NULL}}
}