The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+2 votes
180 views
Is call by address in C same to call by reference in C++? if not then whats basic difference ?? and why doesn't C have a refernce variable just like C++??
asked in Programming by Junior (651 points)
edited by | 180 views
Out of GATE 2017 syllabus , right ?
C programming is there in gate 2017 i was studying that so i got a question so i asked :)
@Gabbar  thanks a lot but what is the ans of this question Is call by address in C same to call by reference in C++?

1 Answer

+3 votes
Best answer
  1. A pointer can be re-assigned any number of times while a reference can not be re-seated after binding.
  2. Pointers can point nowhere (NULL), whereas reference always refer to an object.
  3. You can't take the address of a reference like you can with pointers.
  4. There's no "reference arithmetics" (but you can take the address of an object pointed by a reference and do pointer arithmetics on it as in &obj + 5).
  5. you can have pointers to pointers to pointers offering extra levels of indirection. Whereas references only offer one level of indirection.
  6. A pointer is a variable that holds a memory address. Regardless of how a reference is implemented, a reference has the same memory address as the item it references.

       http://yosefk.com/c++fqa/ref.html

answered by Veteran (25.8k points)
selected by

Related questions

+1 vote
1 answer
1
asked in Programming by Sanjay Sharma Veteran (49.8k points) | 441 views
0 votes
1 answer
2


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,946 questions
36,792 answers
91,068 comments
34,689 users