'=' left operand must be l-value error message

This is a discussion on '=' left operand must be l-value error message within the C++ Programming forums, part of the General Programming Boards category; Hi, When trying to compile my code in MSVC++ I get the error message: error C2106: '=' : left operand ...

  1. #1
    C++ Learner :D
    Join Date
    Mar 2004
    Posts
    69

    '=' left operand must be l-value error message

    Hi,

    When trying to compile my code in MSVC++ I get the error message:

    error C2106: '=' : left operand must be l-value
    The error applies to the 4 highlighted lines in the code below:

    Code:
    mems[mems[0].mem_num].mem_num = mems[0].mem_num;
    mems[mems[0].mem_num].first_name = mems[0].first_name;
        mems[mems[0].mem_num].last_name = mems[0].last_name;
            mems[mems[0].mem_num].dob_dd = mems[0].dob_dd;
            mems[mems[0].mem_num].dob_mm = mems[0].dob_mm;
            mems[mems[0].mem_num].dob_yyyy = mems[0].dob_yyyy;
            mems[mems[0].mem_num].tel_num = mems[0].tel_num;
            mems[mems[0].mem_num].email = mems[0].email;
            mems[mems[0].mem_num].total_rent = mems[0].total_rent;
    Any ideas what the problem is?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,854
    Yes, you can't assign arrays.
    So use strcpy( mems[mems[0].mem_num].email, mems[0].email );

    Next time, post declarations as well.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    C++ Learner :D
    Join Date
    Mar 2004
    Posts
    69
    Thanks for your help salem

    Next time, post declarations as well.
    Ok!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Odd 3D Invis Objects?
    By Zeusbwr in forum Game Programming
    Replies: 4
    Last Post: 12-07-2004, 07:01 PM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  3. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Please help me
    By teedee46 in forum C++ Programming
    Replies: 9
    Last Post: 05-07-2002, 12:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21