【发布时间】:2018-08-18 20:28:06
【问题描述】:
当我编写以下代码时,我得到了预期的错误error: array size missing in 'data'。
int main()
{
unsigned char data[];
return 0;
}
但是,当我运行相同的代码但将有问题的行包含在 struct 中时,没有错误。
typedef struct credit_card_s
{
unsigned char is_valid;
unsigned char data[];
} credit_card_t;
谁能向我解释为什么允许这样做?
【问题讨论】:
-
你的意思是说“未指定的数组大小”。
-
(off-topic: 你能取消删除stackoverflow.com/questions/49396346/…吗?我写了一个我认为很有趣的答案,但你在我完成前几分钟删除了它。在这里评论是因为无处可去评论已删除的帖子)
-
@PeterCordes 已被取消删除
标签: c