Hey, super-duper beginner question time. I'm writing a program to convert decimal (a defined variable x) to binary by testing for division by powers of 2^y for some digits corresponding to 0<=y<=15. When I compile I'm getting
error: lvalue required as left operand of assignment
I did a little research and found that an lvalue is the kind of value output by operators like == and <. I think. Here's my code.
Code:
for(y=14; y>0; y--){
printf("%d", x/(2^y));
(x/(2^y))==0 ? : x/=(2^y);
}
The third line is the one of interest. I also tried putting stuff between the question mark and the colon to make sure that wasn't the "left operand" it's referring to. I don't think it is. But doesn't (x/(2^y))==0 return an lvalue? I'm confused. Some help would be appreciated.