Possible Duplicate:
Error: lvalue required in this simple C code? (Ternary with assignment?)
In the following piece of code I got an error like "lvalue required as left operand of assignment
". I am unable to understand why such an error is being reported. But when I am using parenthesis in the expression like (i>j)?(k=i):(k=j)
it is not reporting an error. please explain.
int main() {
int i = 2;
int j = 9;
int k;
(i > j) ? k = i : k = j;
printf("%d\n", k);
return 0;
}