#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;
^
I have given lvalue as b
then why gcc
is showing error and how to fix it?