I'm trying to write a function to serialise data within a struct so I can send it over UDP by defining a union to map the struct to a byte array:
Code:typedef struct scan_data_t
{
long range;
float angle;
} scan_data_t
typedef union udp_packet_t
{
struct data_t
{
char command;
int num_scans;
scan_data_t *scans;
} data;
char *udp;
} __attribute__((packed)) udp_packet_t;