Hi,
I have a struct that I need to convert to a byte(=char) array. Normally, I know how to do that using memcpy() but in this case the struct contains a pointer that I use to allocate memory dynamically elsewhere is my program.
Something like:
and later on:Code:struct my_struct {
int size;
int num;
int *list;
} sb;
Is this even possible? If it is, what approach should I follow?Code:sb.list = (int*)malloc(some_var);
Thanks.