GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
169 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 (581 points)  
edited by | 169 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 (24.1k points)  
selected by

Related questions

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


Top Users Sep 2017
  1. Habibkhan

    6960 Points

  2. Warrior

    2424 Points

  3. Arjun

    2358 Points

  4. rishu_darkshadow

    2136 Points

  5. A_i_$_h

    2004 Points

  6. nikunj

    1980 Points

  7. manu00x

    1750 Points

  8. makhdoom ghaya

    1750 Points

  9. Bikram

    1744 Points

  10. SiddharthMahapatra

    1718 Points


26,059 questions
33,665 answers
79,739 comments
31,078 users