I want to build a struct and contains int and char variables. Here is my code:
typedef struct {
        uint16_t type;      
        uint16_t sn;
        int data1;
        int data2;
        char crc[1024];
    }packet_t;
Then I use a method to create a struct:
packet_t packetCreate(uint16_t type,uint16_t sn, uint16_t data1, 
uint16_t data2, char crc[1024])
{
    packet_t packet;
    packet.type = type;
    packet.sn = sn; 
    packet.data1 = data1;
    packet.data2 = data2;
    packet.crc = crcr;
    return packet;
}
Also I have defined the corresponding variables in the code. But when I compile the code it doesn't work and displays:
incompatible types when assigning to type ‘char[1024]’ from type ‘char *’ in the line: packet.crc = crcr; How should I define and use the struct? I want to build the struct contains a char string, so I can store the CRC strings of data.
 
     
     
     
     
    