Quote:
Originally Posted by Virus Guy
Friends i am getting an ERROR : L value required for the below program at line no :3.
void main(){
int x=5;
++x++;
printf("X = %d ",x);
}
Can any one please explain me the concept of L value.
|
I think u wanna increment it 2 times i.e 1st pre-increment & then post increment...
ur syntax is wrong dats y u got lvalue required error...
use
++x;
x++;
instead of ++x++;
the compiler reads from left 2 right..so on 3rd line it first sees ur + sign & again
+ sign & then x so it thinks its a preincrement operation..but it also
sees other 2 + sign gets confused & coz the ++x results in a value 2 processing
error is there ....& 4 remaing 2 plus signs it needs a value 2 store them
hence the error