I'm not really sure how this works, but so if i define a structure with a pointer. Theres somewhere in memory that should have the size of this huge data. Because when i do sizeof(Ethfrm) I get 8 because its the size of the pointer. So if this was the way to create the struct. Is there a way to make a copy of this Struct but using new memory.Code:struct Ethfrm_t { struct FCfrm_t* ptr; unsigned char DestEthAdr[6]; unsigned char SrcEthAdr[6]; UINT32 VLAN_HdrSave; UINT32 reserved; UINT32 pad; unsigned char Ethbuffer[BUF_SIZE]; } __attribute__ ((packed)); Ethfrm_t * Ethfrm; Ethfrm = malloc(sizeof(*Ethfrm));
Does this copy all the data in the first struct into the second struct?Code:Ethfrm_t * newframe; newframe = malloc(sizeof(*newframe)); newframe = Ethfrm;