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 type of questions
Can a varargs method be overloaded?
Can abstract class have normal methods?
Explain virtual inheritance?
What is pointer in oop?
What is abstraction oop?
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).
What is the renewal class?
What is a class in oop?
what are the ways in which a constructors can be called?
What is polymorphism programming?
What is the point of oop?
What do you mean by abstraction?
What is ambiguity in inheritance?
Why do we use class in oops?