What is the difference between pass by reference and pass by
value?
Answer Posted / chinna
in Pass by value; if any change in variable in the sub-
function may not reflected to the main function. where as
in pass by reference the change in the variable may reflect
to the original value in the main funtion.
ex : // Pass by Reference
void Get( int &nIndex){
nIndex = 10;
}
void main()
{
int x = 100;
cout<<Get( x );
}
o/p : 10;
ex : // Pass by Value
void Get( int nIndex){
nIndex = 10;
}
void main()
{
int x = 999;
cout<<Get( x );
}
o/p : 999
| Is This Answer Correct ? | 29 Yes | 17 No |
Post New Answer View All Answers
What is and I oop mean?
What is encapsulation example?
What is inheritance in oop?
When not to use object oriented programming?
write knight tour problem which is present in datastructure
What is overloading and its types?
What are main features of oop?
how to get the oracle certification? send me the answer
Why do we use encapsulation in oops?
Is this job good for future? can do this job post grduate student?
What is pointer in oop?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?
Why interface is used?
#include
What is multilevel inheritance?