type struct

1

struct

{int x;

  int y;

}test1;

定义了结构体test1

test1.x和test1.y可以在语句里用了。

2

struct test

{

int x;

int y;

}test1;

定义了结构体test1

test1.x和test1.y可以在语句里使用了。

与1比,1省写了test

3

typedef struct test

{

int x;

int y;

}test1,test2;

这结构体的(类型) 有两个名字test1,test2

 

真正在语句里用,还要写:
text1 test1;
然后好用 test1.x test1.y

或写 text2 test1;
然后好用 test1.x test1.y

 

posted @ 2013-07-08 13:40  army168  阅读(292)  评论(0)    收藏  举报