+ 2

What is the difference between. - - i and i - - ?

29th Dec 2016, 12:16 PM
Pranjal Singh
Pranjal Singh - avatar
7 odpowiedzi
+ 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
26th Jan 2017, 4:30 PM
Amal Reddy Marella
Amal Reddy Marella - avatar
+ 2
Vishal bro if you know the answer please tell it or else do not comment on it
29th Dec 2016, 12:23 PM
Pranjal Singh
Pranjal Singh - avatar
+ 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
29th Dec 2016, 12:23 PM
Florian Castelain
Florian Castelain - avatar
+ 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
1st Mar 2017, 2:11 PM
deepak
deepak - avatar
+ 1
This has been asked so many times. Please search before posting!
29th Dec 2016, 12:18 PM
Vishal++
Vishal++ - avatar
+ 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
29th Dec 2016, 12:22 PM
Daniel Rollins
Daniel Rollins - avatar
+ 1
I++ is the post increment and ++I is the preincrement
1st Mar 2017, 7:56 PM
Shivam choudhary
Shivam choudhary - avatar