copy two struct

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • onlivimal
    New Member
    • Nov 2006
    • 3

    copy two struct

    hi, i have a problem copying two struct data.

    struct Details {
    public:
    char Title[20];
    char Artist[20];
    int noSongs;
    float Price;
    char Category[20];
    };


    Details cd[MAX];
    Details cdTEMP[MAX];

    i used

    cd[i].Title = cdTEMP[i].Title;
    cd[i]Artist = cdTEMP[i].Artist;
    and so on in a FOR loop...

    the compiler gives me an error

    " ISO C++ forbids assignment of arrays"

    can anybody help??
  • Jai Vrat Singh
    New Member
    • Oct 2006
    • 18

    #2
    That is true.
    if you do not want to use loops, use memcopy to copy memory in one go

    Comment

    Working...