I have :
#include<stdio.h>
int main()
{
int a=5,b=6;
(a>b)?b=a:b=b; // Here is the error
return 0;
}
But if I replace :
(a>b)?b=a:b=b; // Error
with
(a>b)?(b=a):(b=b); // No-Error
I understand the lvalue is a value to which something can be assigned and how is it different from rvalue, but why is the extra parenthesis making the difference.
Assignment has a lower precedence than the ternary operator so the line evaluates like:
use: