使用的typedef与实例声明。维基错误? [英] Using typedef with an instance declaration. Wiki error?
本文介绍了使用的typedef与实例声明。维基错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在按照先这个 Wiki页面,就可以编写以下结构:
In accordance to this Wiki page, it is possible to write the following structure:
typedef struct my_struct {
int integer;
} my_struct_t instance;
K&安培; R不要在C Proglamming语言提到这一点。
编译器也编译时返回错误:
K&R do not mention this in "C Proglamming Language". Compiler also returns error during the compilation:
错误:预期 =
,,
,;
, ASM
或 __属性__
在实例
error: expected
=
,,
,;
,asm
, or__attribute__
beforeinstance
它是一个Wiki错误或我做一些愚蠢的事?
Is it a Wiki error or I do something stupid?
推荐答案
您误解了页面。你可以的或者的制作的typedef
,或的定义结构的实例,但不能同时使用。
You misunderstand the page. You can either make a typedef
, or define an instance of the structure, but not both.
如果你读了整个页面,不仅语法块顶部可能是更清晰。
It might be clearer if you read the whole page and not only syntax block at the top.
这篇关于使用的typedef与实例声明。维基错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文