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

Where can I find microsoft visual c++ on my computer?

0 Answers  


What is visual c++ redistributable?

0 Answers  


What is the use of message map? Advantages of a message map.

0 Answers  


What are the two forms of the #include preprocessor directive?

1 Answers  


difference between assert and verify.

0 Answers  






Can I delete old microsoft visual c++?

0 Answers  


What is the use of microsoft visual c++ 2015 redistributable?

0 Answers  


What is the Use of the Developer Studio Editor?

0 Answers   HCL,


What is the RGB macro used for?

1 Answers  


Differences between vc 6.0 and vc 7.0

1 Answers   Honeywell,


Is microsoft visual c++ important?

0 Answers  


What is microsoft visual c++ 2013 redistributable?

0 Answers  


Categories