edited by
628 views
3 votes
3 votes
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++??
edited by

1 Answer

Best answer
3 votes
3 votes
  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

selected by

Related questions

1 votes
1 votes
1 answer
1
Sanjay Sharma asked Jun 4, 2016
1,475 views
what are the differences between call by Reference and Call by Address in different programming languages
1 votes
1 votes
1 answer
3
neha singh asked Aug 26, 2016
929 views
Program P1() { x=10, y=3; func1(y,x,x); print x; print y; } func1(x,y,z) { y=y+4; z=x+y+4; }plzz elaborate the answer explanation?thanks in advance.
0 votes
0 votes
1 answer
4
shree asked Nov 22, 2014
519 views
What will be the second value printed by the program if parameter passing mechanism is call by reference?int b=10 //global begin procedure func(int x,int y) begin print(b...