+ 2
What is the difference between. - - i and i - - ?
7 Réponses
+ 5
well it's quite interesting part
++j is preincrement one it means value is increased by 1 before &it's value is assigned
where as j++ post increment one value is increased but it's increased value is applied to next instruction
for example:
int a=3;
cout<<++a;
o/p:4
where as
int a =3;
cout<<a++;
o/p :3
I hope your ambiguity resolved
+ 2
Vishal bro if you know the answer please tell it or else do not comment on it
+ 2
One will use the value and change the value of i and in the second case it's the oposite:
i = 3;
a = -- i;
=> a = 2 and i = 2
i = 3;
a = i --;
=> a = 3 and i = 2
+ 2
one is pre-decrement other one is post decrement..
on tge basis wheter ut is placed before the variable or after the variable respectively....
example:
int i=7;
cout<<--i; //6 will be printed and value of i=6
cout<<i--; //6 will be printed and value of i=5
+ 1
This has been asked so many times. Please search before posting!
+ 1
while it has been asked many times the answer is post and pre decrement. --I is a pre decrement (which is slightly faster so I use that unless I have a good reason not to) and i-- is post decrement. hey both fundamentally work the same
+ 1
I++ is the post increment
and ++I is the preincrement