Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Can destructor be overloaded?

978


What are main features of oop?

1079


What is encapsulation and abstraction? How are they implemented in C++?

1062


What is class encapsulation?

1029


Why is polymorphism needed?

1000


write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).

2095


Why do pointers exist?

1044


Can abstract class have normal methods?

991


Which method cannot be overridden?

1013


write a program to find 2^n+1 ?

2016


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

2547


What is object in oop with example?

1175


What is the difference between a mixin and inheritance?

933


Why is abstraction used?

1023


What is polymorphism and example?

976