C typedef of pointer to structure

后端 未结 6 868
暖寄归人
暖寄归人 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:31

    It a valid one, what it does is it defines a new type. As @Alex said, it would be useful to define a type and pointer type.

    You could create more pointers just by using

    S1PTR ptr1, ptr2, ptr3, ...;  
    

    instead of

    S1 *ptr1, *ptr2, *ptr3, ...;
    

提交回复
热议问题