【发布时间】:2023-04-05 04:27:01
【问题描述】:
我已经阅读了有关 stackoverflow 的一些答案,但我不知道为什么它仍然不起作用:
typedef struct gnl_struct {
char *data;
int where;
int status;
} t_gnl;
void display_elem(t_gnl tab, int nbr)
{
printf("tab[%d]\n", nbr);
printf("tab.where == %d\n", tab.where);
printf("tab.status == %d\n", tab.status);
return ;
}
int main()
{
static t_gnl tab[1000] = {{ "toto", 0, 2 }} ;
display_elem(tab[3], 3);
return (0);
}
结果是:
tab[3]
tab.where == 0
tab.status == 0
【问题讨论】:
标签: c struct initialization