According to the C Standard (6.2.6 Representations of types)
4 Values stored in non-bit-field objects of any other object type
consist of n × CHAR_BIT bits, where n is the size of an object of that
type, in bytes. The value may be copied into an object of type
unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
called the object representation of the value.
So you can write simply
unsigned char foo[sizeof( struct myStruct )];
struct myStruct s = { /*...*/ };
memcpy( foo, &s, sizeof( struct myStruct ) );
Take into account that you could copy the data members separatly in one array. For example
unsigned char foo[30];
struct myStruct s = { /*...*/ };
unsigned char *p = foo;
memcpy( p, s.member1, sizeof( s.member1 ) );
memcpy( p += sizeof( s.member1 ), s.member2, sizeof( s.member2 ) );
memcpy( p += sizeof( s.member2 ), s.member3, sizeof( s.member3 ) );