在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}}
}