arrays - incompatible types in assignment c -


i have following structs defined in header file,

struct nl_packet {       int seq;       frametype type;       cnetaddr dest;       cnetaddr src;       uint32_t checksum;       size_t length;       char data[nl_maxdata];     };   struct seq_info  {     int seqnum;    size_t length;    char data[nl_maxdata];  };  struct msg_received {     cnetaddr src;    struct seq_info seqinfo[bufsiz];    int lastreceived;  }; 

and in file, have following assignment comes "incompatible types in assignment error",

msgrec[i].seqinfo[j].data = packet.data; 

i have other statements in same method work fine,

msgrec[i].seqinfo[j].seqnum = packet.seq; msgrec[i].seqinfo[j].length = packet.length; 

even though both, data fields in nl_packet struct , seq_info struct have same type, error coming ??

thanks in advance

you assigning arrays. can not that. have copy array contents. may this:

memcpy(msgrec[i].seqinfo[j].data, packet.data, sizeof(char)*nl_maxdata);


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -