How to cast C struct just another struct type if their memory size are equal?
- by Eonil
I have 2 matrix structs means equal data but have different form like these:
// Matrix type 1.
typedef float Scalar;
typedef struct { Scalar e[4]; } Vector;
typedef struct { Vector e[4]; } Matrix;
// Matrix type 2 (you may know this if you're iPhone developer)
struct CATransform3D
{
CGFloat m11, m12, m13, m14;
CGFloat m21, m22, m23, m24;…