3 回答
TA贡献1828条经验 获得超3个赞
typedef struct X {
int x; } X;struct S {
int x; };typedef struct S S;Sstruct S:
void f( struct S argument ); // struct is required here
S
void f( S argument ); // struct keyword no longer needed
S
typedef struct S {
int x; } T;void S() { } // correct//void T() {} // error: symbol T already defined as an alias to 'struct S'typedef
// C++struct S {
int x; }; // S defined as a classvoid f( S a ); // correct: struct is optionalSS
typedef struct S {
int x; } T;void S() {} // correct [*]//void T() {} // error: symbol T already defined as an alias to 'struct S'Sstruct
// previous code here...int main() {
S();
struct S s;}TA贡献1839条经验 获得超15个赞
structtypedef
struct
struct foo {
int n;};struct foofoostructnamespace
A typedef
typedef int my_int;
my_intint; my_intintstruct
typedef struct foo foo;
struct footypedeffoo.
structtypedef
typedef struct bar {
int n;} bar;struct barbar.
struct
typedef struct node {
int data;
struct node *next; /* can't use just "node *next" here */} node;typedef struct node_s {
/* ... */} node;typedefstruct bartypedefn
struct blahblah
- 3 回答
- 0 关注
- 650 浏览
添加回答
举报
