GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Programming  >  C++

 Print  |  
Question:  Register Relation

Answer: Why p++ is faster than p+1?


October 10, 2009 11:52:11 #6
 AlexeyP   Member Since: October 2009    Total Comments: 4 

RE: Register Relation
 
I think P++ and ++P are the same

No, not the same.

For P++ you have to save value in a temp, increment *this, then return the saved value.

For ++P, you just increment and return -- less work.
     

 

Back To Question