C typedef of pointer to structure

后端 未结 6 872
暖寄归人
暖寄归人 2020-11-27 13:52

I had come across the following code:

typedef struct {
        double x;
        double y;
        double z;
} *vector;

Is this a v

6条回答
  •  一向
    一向 (楼主)
    2020-11-27 14:29

    Absolutely valid. Usually, you can take full advantage of this way by defining two types together:

    typedef struct
    {
     int a;
     int b;
    } S1, *S1PTR;
    

    Where S1 is a struct and S1PTR is the pointer to this struct.

提交回复
热议问题