What is the difference between pass by value,pass by
pointer,pass by reference in the catch block in the
exception handling in c++
Answer Posted / guest
$ pass by value: it does not change the content of the
argument variable in the calling function even if they
changed in the called function.Because the content of the
actual parameter in the caller is copied to the
formalparameter of the callee.
so change to the parameter withen the function
will effect only the copy.
$ pass by pointer or pass by address:in this the address of
actual parameters is passed i.e address of the variable
copied in the called function.
so any change to the parameter within the
function will reflect to the caller function parameter i.e
actual parameters are modified.
$ pass by referance : it has syntax of pass by value and
funcionality of pass by pointer.
i.e
the referance type formal parameter are accessed in the same
way as normal value parameters but if any change to them
will also reflected to the actual parameter.
see the diff:
P by V:
int main()
{
int a,b;
f(a,b);//caller
}
f(int x, int y);//called
$P by P:
int main()
{
int a,b;
f(&a,&b);//caller
}
f(int *x, int *y);//called
$ P by R:
int main()
{
int a,b;
f(a,b);//caller
}
f(int &x, int &y);//called
| Is This Answer Correct ? | 16 Yes | 1 No |
Post New Answer View All Answers
Why do we use inheritance?
can inline function declare in private part of class?
What is the difference between static polymorphism and dynamic polymorphism?
What is stream in oop?
What are classes oop?
What are objects in oop?
I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...
What is for loop and its syntax?
What is abstraction and encapsulation?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
How to use CMutex, CSemaphore in VC++ MFC
What is the main feature of oop?
write a program that takes input in digits and display the result in words from 1 to 1000
What causes polymorphism?
What is the difference between inheritance and polymorphism?