I know that -->
is not an operator. It is in fact two separate operators --
and >
.And it is same as like below opearation.
while( (x--) > 0 )
Now i ran two programs but it arose some confusion in me.
First Program:
int main(void)
{
int x = 10;
while(----x>0)
{
cout<<x<<endl;
}
}
Output: 8 6 4 2
Second Program:
int main(void)
{
int x = 10;
while(x---->0)
{
cout<<x<<endl;
}
}
I got compilation error:
lvalue required as decrement operand
Actually what is happening here?? why the first program is running successfully but not the second one??