RE: invalid lvalue in assignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Oliver,

Here is an example of an invalid lvalue in assignment:

: cat test.c
int foo()
{
        return 7;
}

int main()
{
        foo() = 3; // Line 8
}

: gcc test.c
test.c: In function 'main':
test.c:8: error: invalid lvalue in assignment

Notice that line 8 is trying to assign 3 to an rvalue.  An rvalue is not an lvalue.

Also notice that GCC indicated the line, 8, that the invalid lvalue in assignment is being attempted.

I can only give you a general example and guidelines as to how things are going awry in the error you've encountered.  If you can provide a small compilable example of the problem you are facing, I can give you better advice.

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux