Casting one C structure into another

前端 未结 8 678
再見小時候
再見小時候 2020-11-27 03:30

I have two identical (but differently named) C structures:

typedef struct {
      double x;
      double y;
      double z;
} CMAcceleration;


typedef struc         


        
8条回答
  •  难免孤独
    2020-11-27 04:08

    Why dont you use.

    typedef CMAcceleration Vector3d;
    

    (instead of creating a whole new structure)

    in that case vector = acceleration; compiles just fine.

提交回复
热议问题