![]() |
lvalue required??
Code:
# define TWICE(i) 2*i wat does it mean??? |
Re: lvalue required??
It means you aren't using #defines and the predecrement operator correctly.
--TWICE(no) expands to --2*no and you can't predecrement a constant. However, in the case of TWICE, even brackets don't fix the problem because --(2*no) still won't work because 2*no is not an lvalue. An lvalue ("left value") is something you can put on the left of an assign, so in i=5, i is the lvalue and this is valid because you can assign a value to it. 5=i is invalid because you can't assign a value to 5. (2*no)=7 is invalid because you can't assign a value to (2*no). --TWO(no) will "work" - in the sense that it won't throw an error, but you're still abusing the -- operator. This will expand to --i+i which gives undefined results. |
Re: lvalue required??
Thank u for giving me a clear view..:)
|
| All times are GMT +5.5. The time now is 22:30. |