#include <stdio.h>
int main()
{
int a = 1, b;
a ? b = 3 : b = 4;
printf("%d, %d", a, b);
return 0;
}
[user@localhost programs]$ gcc -Wall vol.c
vol.c: In function ‘main’:
vol.c:5:16: error: lvalue required as left operand of assignment
a ? b = 3 : b = 4;
^
我已经给出了左值,b
那么为什么gcc
会显示错误以及如何修复它?