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
  • unsigned int A[8];
    unsigned int B[8];
    unsignned int i;
    
    for (i = 0; i = 7; i++)
    A[i] = B[i]; /* error here */

    There is a typo in your 3rd line:
    unsignned int i
    Did the compiler report an error on this line?

    It seems to be a "feature" of the Keil compiler that it will report this error (C213) on every line containing an array reference after any other error has been reported on a previous line.
    Maybe Keil support could comment on this?

    In any compiled language, you should always fix the first reported error first; chances are this will also fix many of the following "errors," which were just due to the compiler getting out-of-step with your intentions.

    BTW: Check out the "Tips for Posting Messages" link in the sidebar to see how to do the code quotes, italics, bold, etc.

Reply
  • unsigned int A[8];
    unsigned int B[8];
    unsignned int i;
    
    for (i = 0; i = 7; i++)
    A[i] = B[i]; /* error here */

    There is a typo in your 3rd line:
    unsignned int i
    Did the compiler report an error on this line?

    It seems to be a "feature" of the Keil compiler that it will report this error (C213) on every line containing an array reference after any other error has been reported on a previous line.
    Maybe Keil support could comment on this?

    In any compiled language, you should always fix the first reported error first; chances are this will also fix many of the following "errors," which were just due to the compiler getting out-of-step with your intentions.

    BTW: Check out the "Tips for Posting Messages" link in the sidebar to see how to do the code quotes, italics, bold, etc.

Children
No data