This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Transferring Array Data/ Error Message c213


In trying to compile the following ( trivial to me) C code with the C51
compiler, I received error c213 "left side of asn-op not an lvalue" -
" the address of a changeable object is required at the right side of the
assignment operator".

Code:
unsigned int A[8];
unsigned int B[8];
unsignned int i;

for (i = 0; i = 7; i++)
A[i] = B[i]; /* error here */

Is it the compiler or the code???

Any help or comments appreciated.

Thanks

Andy

Parents
  • The following code seems to work OK:

    void main (void)
    {
    unsigned int A[8];
    unsigned int B[8];
    unsigned int i;
    
    for (i = 0; i < 8; i++)
      {
      A[i] = B[i]; /* error here */
      }
    }

    In your code, there are few problem that prevent testing:

    1. unsignned int i: I assume this is really unsigned.

    2. for (i = 0; i = 7; i++): The middle expression of a for statement should be a comparison, not an assignment.

    Keil Support

Reply
  • The following code seems to work OK:

    void main (void)
    {
    unsigned int A[8];
    unsigned int B[8];
    unsigned int i;
    
    for (i = 0; i < 8; i++)
      {
      A[i] = B[i]; /* error here */
      }
    }

    In your code, there are few problem that prevent testing:

    1. unsignned int i: I assume this is really unsigned.

    2. for (i = 0; i = 7; i++): The middle expression of a for statement should be a comparison, not an assignment.

    Keil Support

Children
No data