const char* msg1 = "hello how are you";
uint8_t msg2[] = "hai";
How to copy msg1 to msg2?
You cannot copy the whole content since msg2 is of type uint8_t[4] and hence cannot hold the whole message. You should also keep in mind this copies from signed char to a different unsigned type.
You can copy either using a for loop or the memcpy function. e.g.
memcpy(msg2, msg1, min(sizeof(msg1), sizeof(msg2)));
If you want to deal with the strings I would recommend using a signed destination and the use of strncpy function
char msgBuffer[0x80U];
strncpy(msgBuffer, msg1, min(0x80U, strlen(msg1)));
In both cases please keep the boundaries in mind to prevent out-of-bound memory reads or writes.