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  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 216 of 255    Print  
Why use references when pointers can do everything references can do?

  
Total Answers and Comments: 5 Last Update: October 09, 2007     Asked by: supriya ahire 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 27, 2006 00:32:40   #1  
rajat kumar patel        

RE: Why use references when pointers can do everything...

in references to memory block


 
Is this answer useful? Yes | No
March 27, 2006 02:04:23   #2  
Vedika        

RE: Why use references when pointers can do everything...

hi

References are used when the refered variable cotent are constants. Where as the content of pointer variable are variant may change. So where a constant reference to a variable is required references are used instead of opinters. Best example is in copy constructors one has to use references instead of pointers.

Regards,

Vedika


 
Is this answer useful? Yes | No
April 05, 2006 07:07:39   #3  
sanneeta        

RE: Why use references when pointers can do everything...

using pointers are more complex, while using references are simpler to understand.

The indirection is hidden, and there is no need to repeatedly dereference the variable in case of references.

Though pointers are difficult to use, they offer more flexibility.  References cannot be null and they cannot be reassigned.


 
Is this answer useful? Yes | No
May 09, 2006 06:00:06   #4  
lakshmi narasimha rao        

RE: Why use references when pointers can do everything...
pointers can do everything but it isdifficult & complex when compare to references.
 
Is this answer useful? Yes | No
October 09, 2007 15:38:51   #5  
Visitor        

RE: Why use references when pointers can do everything...
With pointers you can do pointer arithmatic like increment or decrement the pointer.

You cant do that with reference.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape