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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -