#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);
}
输出
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;
^
- 为什么第一个作业有效而第二个无效?
- 为什么编译器告诉需要左值?