Compiler Error 137

expression must be a modifiable lvalue

An lvalue is value that is allowed to be on the Left hand side of an assignment statement. For example in the following statement, the variable Value is the lvalue as it is on the left hand side of the statement and is having its value modified to be 24.

Value = 24;

This error would be generated for the following example as the if conditional contains an assignment which attempts to assign the Value variable to the literal 24. Since 24 isn't an lvalue, the error is generated.

#include "mbed.h"

int main() 
{
    int Value = 24;
    
    if (24 = Value)  // *** This line will generate the error.
    {
        printf("Value is equal to 24.\n");
    }
}

All wikipages