What is the performance difference between i++ and ++i? Considering the following 2 conditions.1. i++; vs ++i;2. int j = i++; vs int j = ++i;

Showing Answers 1 - 1 of 1 Answers

ramki

  • Jan 24th, 2007
 

hiii......frendz.this ramki1)i++ vs ++i i++ : first gives the current value of " i " and then increments the value of " i " bye one. ++i : first the value of " i " gets incremented bye 1 and then gives the new value of " i ".2)int j = i++; vs int j = ++i; int j = i++; ----> first the current value of " i " will be given to " j " and the the value of i gets incremented by one. int j = ++i; ----> first the value of " i " gets incremented by one and then the incremented value of " i " is given to the " j ".

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions