Compilation error message- Lvalue required in C ??? What it actually mean?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Compilation error message- Lvalue required in C ??? What it actually mean??

21st Jan 2017, 2:35 PM
Ankish Gupta
Ankish Gupta - avatar
7 Answers
+ 3
if you are performing a operation like int a; 5=a; then it will give you error L value recquired because the compiler assumes a variable name on left hand side to store value in it. Hope it helps.
21st Jan 2017, 3:47 PM
Rishabh Agrawal
Rishabh Agrawal - avatar
+ 2
lvalue evaluates to location value. cout<<I++++; would produce such an error.
21st Jan 2017, 3:34 PM
Megatron
Megatron - avatar
+ 2
void main(){ int i=5; printf("%d",(i++)+(++i)); } should work if your syntax is correct I know c++ syntax and not c syntax
22nd Jan 2017, 5:38 AM
Megatron
Megatron - avatar
+ 2
yes it would the either way because your code must be evaluated as (I++++)+I; And as I told I++++ gives lvalue error.
22nd Jan 2017, 5:46 AM
Megatron
Megatron - avatar
+ 1
i think you are forget to include a library or using wrong method dosen't work in c
21st Jan 2017, 3:09 PM
Aous Mohammad
Aous Mohammad - avatar
+ 1
void main(){ int i=5; printf("%d",i+++++i); } here it is giving Lvalue required....
22nd Jan 2017, 5:36 AM
Ankish Gupta
Ankish Gupta - avatar
+ 1
Megatron it is working using paranthes or giving space i++ + ++i
22nd Jan 2017, 5:44 AM
Ankish Gupta
Ankish Gupta - avatar