struct 结构体笔记

来源:互联网 发布:淘宝客服销售是干什么 编辑:程序博客网 时间:2024/06/05 08:26

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
1 0
原创粉丝点击