1)
struct tag {
member-list
} variable-list ;
tag:结构体标签
variable:结构体变量
member-list:结构体成员
2)
struct {
int a;
char b;
double c;
} s1;
s1.a=123;
s1.b="123";
s1.c=1.23;
想要s2 也声明成上面的结构体怎么办?看下面哈
3)
struct SIMPLE{
int a;
char b;
double c;
};
struct SIMPLE t1, t2[20], *t3;
struct SIMPLE t2;
//这里struct SIMPLE (相当于int,float)
//这里声明居然要2个单词 下面就不用了
4)
typedef struct Simple2{
int a;
char b;
double c;
} S2;
S2 u1, u2[20], *u3;
相当于
struct Simple2{
int a;
char b;
double c;
};
typedef struct Simple2 S2;
S2 u1, u2[20], *u3;
5)
typedef struct{
int a;
char b;
double c;
} S2;
S2 u1, u2[20], *u3;
//可以省略上面的Simple2
6)
@interface Person:NSObject{
int a;
int b;
}
@end