What is the difference between pointer and reference?

Answers were Sorted based on User's Feedback



What is the difference between pointer and reference?..

Answer / treker

1. Pointer can refer NULL, refernce cannot be NULL
2. Pointer can derefernce to another address, Reference
once initialized stays that way till it dies.
3. pointer may not associate with a legitimate memory but
References should associate with certain memory.
4. pointer may not be initialized while created but
refernce has to intialized when it is created.

Is This Answer Correct ?    50 Yes 4 No

What is the difference between pointer and reference?..

Answer / praveena

A reference must always refer to some object and,
therefore, must always be initialized;
pointers do not have such restrictions. A pointer can be
reassigned to point to different
objects while a reference always refers to an object with
which it was initialized.

Is This Answer Correct ?    30 Yes 5 No

What is the difference between pointer and reference?..

Answer / noopur sharma(m.c.a. r.u)

1)it is not necessary to intialize a pointer at the time of
declaration.like:int a=10; int *p=&a;
u can also do int a=10; int *p; p=&a;
but in the case of reference it is necessary to
intialize a ref.at the time of declaration.like: int
&a=10;bcoz ref.is the secondname(aliase)for an object.means
it always refere an object so it's necessary to initialize
it.
2)u can assign NULL to a pointer.like int *p=NULL; but u
can't assign NULL to a reference.like int
&P=NULL//incorrect.
3)u can create array to a pointer but u can't create
array to a ref.
4) u can use pointer to pointer.but u can't use ref.to ref.
5) pointer is a new variable that contain the address of
another variable.but ref. is a second name (aliase) of the
same variable.
6)to store pointer we require extra memory.but for
reference we don't require extra memory.

Is This Answer Correct ?    12 Yes 2 No

What is the difference between pointer and reference?..

Answer / hari krishna

http://www.dgp.toronto.edu/~patrick/csc418/wi2004/notes/Poin
tersVsRef.pdf

Is This Answer Correct ?    10 Yes 2 No

What is the difference between pointer and reference?..

Answer / mritunjay rai

1)it is not necessary to intialize a pointer at the time of
declaration.like:int a=10; int *p=&a;
u can also do int a=10; int *p; p=&a;
but in the case of reference it is necessary to
intialize a ref.at the time of declaration.like: int
&a=10;bcoz ref.is the secondname(aliase)for an object.means
it always refere an object so it's necessary to initialize
it.
2)u can assign NULL to a pointer.like int *p=NULL; but u
can't assign NULL to a reference.like int
&P=NULL//incorrect.
3)u can create array to a pointer but u can't create
array to a ref.
4) u can use pointer to pointer.but u can't use ref.to ref.
5) pointer is a new variable that contain the address of
another variable.but ref. is a second name (aliase) of the
same variable.
6)to store pointer we require extra memory.but for
reference we don't require extra memory.

Is This Answer Correct ?    4 Yes 2 No

What is the difference between pointer and reference?..

Answer / basudha

A reference must always refer to some object and,
therefore, must always be initialized;
pointers do not have such restrictions. A pointer can be
reassigned to point to different
)u can assign NULL to a pointer.like int *p=NULL; but u
can't assign NULL to a reference.like int
&P=NULL//incorrect.

Is This Answer Correct ?    3 Yes 1 No

What is the difference between pointer and reference?..

Answer / satyendra singh

i am also satisfied whose already given answer but major
differnce b/w reference and pointer
1--refrence and pointer both are refer memori address
2--with help of pointer arithmatic calculation done but
pointer not done;
3--refrence tracked by garwage collection but pointer not done;
4--referece must alway refer object which must initialized

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More VC++ AllOther Interview Questions

Is it ok to uninstall microsoft visual c++?

0 Answers  


What is the value of the expression a = 42?

2 Answers  


What are the advantages of a message map

0 Answers  


What is microsoft visual c++ runtime library error?

0 Answers  


What is microsoft visual c++ 2015 redistributable package x64?

0 Answers  






What is visual c++ 2010 redistributable package x64?

0 Answers  


How to create a DLL in C++.net 2005 which we can use in VB 6.0 application ?

0 Answers   Soft Solutions,


hi i have 1180 in gre and 109 in toefl i have one more backlog to clear now. My classes got over in 2007 july. can i put a course completion certificate for my f1 visa interview. plz help

2 Answers  


What is vcredist_x86 exe?

0 Answers  


What is the purpose of a C++ namespace?

2 Answers  


Do I need ms visual c++ on my computer?

0 Answers  


What is vc++ programming?

0 Answers  


Categories