I have a structure
typedef struct
{
float m[4][4];
} myMatrix;
due to some need in the program i need to convert this to float *
I'm doing something like
if(! g_Fvar16)
g_Fvar16 = (float*)malloc(sizeof(float) * 16);
memcpy(&g_Fvar16, &struct_var, sizeof(float)*16);
return g_Fvar16;
This is one simple feature. Now, when I call this function, the program crashes when accessing these values. g_Fvar16is anfloat*
sizeof(struct_var) equal to 64, as well as the amount of allocated memory.
Can't I just process the copied memory as float *? I would be the fastest ...
Adorn source
share