#include <stdio.h>
void main()
{
int k = 8;
int m = 7;
int z = k < m ? k = m : m++;
printf("%d", z);
k = 8;
m = 7;
z = k < m ? m++ : k=m;
printf("%d", z);
}
Output
Compile Error:
main.c: In function 'main':
main.c:19:32: error: lvalue required as left operand of assignment
z = k < m ? m++ : k=m;
^
- Why the first assignment works and second doesn't?
- And why the compiler tells that lvalue is required?