What is difference between pass by reference and pass by pointer?

Answer:
In c++ we can pass parameter in a function in three different ways.
(a)Pass by value
(b)Pass by pointer
(c)Pass by reference


Pass by pointer:  In this approach, in the function call statement address of actual variable is passed and in the function body with the help of pointer we can access that variable. For example:
Pass by reference: This approach is only possible in c++ not in c. In c++ there is concept of reference variable. Reference variable always keeps actual copy of variable. So any modification is done in reference variable is also reflects in actual variable.  

No comments: