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?

Answers were Sorted based on User's Feedback



What is the difference between pass by reference and pass by value?..

Answer / anandan

in pass by referance the parameters are passed as the
address of the variables whereas in pass by value the
variables are directly passed as parameters

Is This Answer Correct ?    99 Yes 17 No

What is the difference between pass by reference and pass by value?..

Answer / subha raman

In case of pass by value..the change in the sub-function
will not cause any change in the main function wheareas in
pass by reference..the change in the sub-function will
change the value in the main function..

Is This Answer Correct ?    57 Yes 9 No

What is the difference between pass by reference and pass by value?..

Answer / manila

Pass By Value:

1.It passes the actual value of parameter from the function
call.
2.Value of the parameter variable in calling functions
remains unchanged.
3.copy of the variable of actual parameter are made and
transfer to the formal parameter.

call By Reference:

1.the address of the actual parameter has to be transfered
2.the formal parameter in the function decleretion must of
pointer type.
3.Any changes in the formal parameter can change the value
of actual patameter.

Is This Answer Correct ?    30 Yes 11 No

What is the difference between pass by reference and pass by value?..

Answer / 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

What is the difference between pass by reference and pass by value?..

Answer / ganesh

in pass by referce function can access original memory
location of variable so can access value while in case of
pass by value fuction can copy the value of variable to the
prototype of its kind of variable so calling funcion can
access the prototype variable but not the direct original
variable.

Is This Answer Correct ?    16 Yes 9 No

What is the difference between pass by reference and pass by value?..

Answer / sravanthi

pass by reference is nothing but a value is called by using
its reference value i.e., its address value where as pass by
value is that which is called by its value initialized.

Is This Answer Correct ?    10 Yes 3 No

What is the difference between pass by reference and pass by value?..

Answer / anwer sayed

Pass By Reference :
In Pass by reference address of the variable is passed to a
function. Whatever changes made to the formal parameter will
affect to the actual parameters
- Same memory location is used for both variables.(Formal
and Actual)-
- it is useful when you required to return more then 1 values
Pass By Value:
- In this method value of the variable is passed. Changes
made to formal will not affect the actual parameters.
- Different memory locations will be created for both variables.

Read more:
http://wiki.answers.com/Q/What_is_the_difference_between_pass_by_value_and_pass_by_reference_in_c#ixzz16MOpWSLk

Is This Answer Correct ?    3 Yes 0 No

What is the difference between pass by reference and pass by value?..

Answer / john otieno onyango

passby value a copy of the entire object is passed to the
function
While
pass by reference only the address of the object is
transferred to the function

Is This Answer Correct ?    2 Yes 0 No

What is the difference between pass by reference and pass by value?..

Answer / giridhar varma

hello!all the above answers are correct!

Is This Answer Correct ?    18 Yes 17 No

What is the difference between pass by reference and pass by value?..

Answer / prakash

give me the sample code of pass by reference and pass by
value in c++ !!!!!!!1

Is This Answer Correct ?    5 Yes 5 No

Post New Answer

More OOPS Interview Questions

Can we have inheritance without polymorphism?

0 Answers  


WHAT IS THE DIFFERENCE BETWEEN ABSTRUCTION AND ENCAPSULATION? PLEASE EXPLAIN IT.

7 Answers   ETH,


write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

0 Answers   Microsoft, TCS,


What is overriding vs overloading?

0 Answers  


explain dynamic binding by drowing

2 Answers   Cognizant,


What is a macro? And how is a macro same as a template?

4 Answers  


why the argument is passed by reference to a copy constructor?example?

2 Answers  


What is object in oop?

0 Answers  


Polymorphism with an example?

8 Answers   Accenture, emc2,


Write a program to reverse a string using recursive function?

0 Answers   TCS,


what is use to destroy an object? illustrate.

5 Answers   TCS,


What are different oops concepts?

0 Answers  


Categories