I want to copy some part of data into source_mac
This is my code:
uint8_t *data
uint8_t *source_mac
memcpy(&source_mac, &data[6], 6);
So I want to copy 6 bytes from data, starting with the 6th byte in data, into source_mac... What am I doing wrong?
There are multiple problems in your code fragment:
data[5]&source_macas the destination, which is the address of thesource_macpointer, not the address of the destination array. You should either pass&source_mac[0]or simplysource_macHere is a modified version: