0

I am very new to programming. I know about numerical and logical operators. But I have never seen this- <-- operator. I searched over internet but got nothing helpful.

Here is the code:

int i=5;
while(0 <-- i){
    printf("%d\n", i);
}

The output is:

 4
 3
 2
 1

What is this operator? What does it do?


Edit: I also wish to know about other confusing composite operators like this.

Minhas Kamal
  • 20,752
  • 7
  • 62
  • 64
  • 3
    It is challenging to search for, but see this answer, it's helpful: http://stackoverflow.com/questions/1642028/what-is-the-name-of-the-operator – Brian Cain Mar 06 '16 at 17:37

1 Answers1

2

<-- is not an operator, it is < and -- written without space. Just to make it clear, I rewrite the code like this-

while(0 < --i)

First the value of i is decreased, and then compared if it is greater than 0.

Similar question was asked here.

Community
  • 1
  • 1
Minhas Kamal
  • 20,752
  • 7
  • 62
  • 64