+ 2
What is this <-- ? (Anyone explain this for me)
i didn't read about this operator before. First time, i saw it in a challenge. . int a=0; int b=13; while ( b <-- 1) { a++; } cout <<a; output is 12
8 Answers
+ 11
@bhRT
example/
int a = 12;
int b = 12;
int c = 0;
if(b > --a)
c++;
cout << c;
output: 1.
I did this with an if statement, I'm assuming you know how it would work in a while loop. (same stuff just looping till false).
--a with decrement a then use it.
so:
if(b > --a)
is the same as:
if (12 > 11)
* the value of a is now 11.
* value of b is still 12.
If your still confused on --a, take a look at these explanations of what they are:
++x
x++
--x
x--
https://www.sololearn.com/Discuss/305422/?ref=app
+ 13
<-- is actually just < --1
It's 2 operators, without the space it looks like one.
< is less than.
--x decrements x before using it.
So while(b<0)
// do code
ps: I think you wrote the question incorrecly, I'm not sure how a can be 12.
Unless I'm missing something that c++ has.
+ 9
oups lol. I'll edit it to >.
+ 4
big bro i didn't remember exactly.
can you please give me example .
+ 3
bro in your example
if (b <--a) // is false
then why output is 1
+ 3
đđđđ
+ 1
12
0
bHRT it is (b >--a)