0
i dont understand decreament??
5 odpowiedzi
0
It means reduce. So if you see i--(which can also be written as i=i-1) means reduce i by 1 after you finish this statement. Or if you see --i, it means, reduce i by 1 first then finish this statement
0
an example for decreament
0
int a = 2;
if(a < 5)
a--;
cout << a;
this will print 1
0
and example of --a
0
int a = 2;
if(a < 5)
cout << a--;
cout << a;
the code above will print 2 then 1
int a = 2;
if(a < 5)
cout << --a;
cout << a;
This code will print 1 then 1.