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

what type of questions

2109


Can a varargs method be overloaded?

1083


Can abstract class have normal methods?

1029


Explain virtual inheritance?

1171


What is pointer in oop?

1027


What is abstraction oop?

1064


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).

2098


What is the renewal class?

2742


What is a class in oop?

1103


what are the ways in which a constructors can be called?

2113


What is polymorphism programming?

1110


What is the point of oop?

1159


What do you mean by abstraction?

1053


What is ambiguity in inheritance?

1093


Why do we use class in oops?

948