If I give an Equal to relational operator in the first expression of the ternary operator of the following code, then it outputs 10,20, which I have understood.
#include <stdio.h>
int main()
{
int a=10, c, b;
c = (a==99) ? b = 11:20;
printf("%d, %d", a, c);
return 0;
}
But, When I place an Assignment operator instead of the Equal to relational operator (code is given below), then it outputs 99, 11. Now I am not getting how this Assignment operator is treated in the first expression of the ternary operator.
#include <stdio.h>
int main()
{
int a=10, c, b;
c = (a=99) ? b = 11:20;
printf("%d, %d", a, c);
return 0;
}