结构体

    xiaoxiao2025-02-26  46

    给类型其别名

    结构体定义的三种方式:

    struct 结构体名

    {

    各种参数

    };

    Struct 结构体名 变量名

    变量名.结构参数=xxx;

    Eg:

        struct m

        {

            int a;

            int b;

        };

     struct m m1; //这里就比较麻烦,每次用都要这样写struct,可以typedef定义。

          m1.a =10;

    ps结构体是可以嵌套的

              

    struct结构体名

    {

    各种参数

    }变量名1,变量名2

    Eg:

        struct m

        {

            int a;

            int b;

       

        }m1,m2;

          m1.a =10;

    ps:

     

    3、struct         (这里是空的)

    {

    各种参数;

    }m1,m2;

    Ps:

     

     

    引用《c语言设计》谭浩强 

    最新回复(0)