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

What is microsoft visual c++ redistributable and do I need it?

0 Answers  


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

0 Answers  


What is a transparent image?

1 Answers  


Can I delete old microsoft visual c++?

0 Answers  


What is ole? How do you handle drag and drop in ole?

0 Answers  






What is the difference between Undo and Redo?

15 Answers   Google,


Do you need microsoft visual c++?

0 Answers  


What is a mnemonic?

1 Answers  


How do I create an mfc application in vc++?

0 Answers  


How do I get rid of microsoft visual c++ runtime library error?

0 Answers  


Explain the significance of initapplication() in vc++.

0 Answers  


Is visual c++ the same as c++?

0 Answers  


Categories