All Questions

4968
votes
73answers
1475090 views

Is Java "pass-by-reference" or "pass-by-value"?

I always thought Java was pass-by-reference; however I've seen a couple of blog posts (For example, this blog) that claim it's not. I don't think I understand the distinction they're making. What is...
1893
votes
22answers
853837 views

How do I pass a variable by reference?

The Python documentation seems unclear about whether parameters are passed by reference or value, and the following code produces the unchanged value 'Original' class PassByReference: def __init_...
1048
votes
28answers
267744 views

Is JavaScript a pass-by-reference or pass-by-value language?

The primitive types (Number, String, etc.) are passed by value, but Objects are unknown, because they can be both passed-by-value (in case we consider that a variable holding an object is in fact a re...
395
votes
18answers
439631 views

What's the difference between passing by reference vs. passing by value?

What is the difference between a parameter passed by reference a parameter passed by value? Could you give me some examples, please?
209
votes
7answers
105986 views

How to pass objects to functions in C++?

I am new to C++ programming, but I have experience in Java. I need guidance on how to pass objects to functions in C++. Do I need to pass pointers, references, or non-pointer and non-reference values...
282
votes
4answers
204103 views

Javascript by reference vs. by value

I'm looking for some good comprehensive reading material on when Javascript passes something by value and when by reference and when modifying a passed item affects the value outside a function and wh...
247
votes
9answers
97884 views

Does Javascript pass by reference?

Does Javascript pass by references or pass by values? Here is an example from Javascript: The Good Parts. I am very confused about my parameter for the rectangle function. It is actually undefined, an...
202
votes
12answers
84540 views

Is Ruby pass by reference or by value?

@user.update_languages(params[:language][:language1], params[:language][:language2], params[:language][:language3]) lang_errors = @user.errors logger.de...
195
votes
8answers
251672 views

Pass Variables by Reference in Javascript

How do I pass variables by reference in JS? I have 3 variables that I want to perform several operations to so I want to put them in a for loop and perform the operations to each one. pseudo code: m...
32
votes
6answers
94633 views

Pass by Reference / Value in C++

I would like to clarify the differences between by value and by reference. I drew a picture So, for passing by value, a copy of an identical object is created with a different reference, and the...

Previous Next