python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
What is the difference between passing by reference and passing by value of arrays for recursive calls which share a reference via a closure?
I was working on a solution to the following prompt: Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.
The following code passes t...
Leo C.
Votes: 0
Answers: 0
Does it refer to the same object or not when an object is passed as an argument of the constructor of another class?
So I came across some confusing code like this.
public class Class1 {
private Class2 class2 = new Class2(this);
public void dispose() {
if (class2 != null) {
class2.dispos...
Imal
Votes: 0
Answers: 1
Optimizing away static variable / passing by reference
In this question Will a static variable always use up memory? it is stated that compilers are allowed to optimize away a static variable if the address is never taken, e.g. like following:
void f() {
...

tommsch
Votes: 0
Answers: 2
Reference assignment operator ( =& ) combined with passed by reference ( &$var ) in PHP
Why is the variable passed by reference not changed when the assignment is also made with a reference?
function foo(&$x) {
$y = 1;
$x = &$y;
}
$bar = 0;
foo($bar);
echo $bar; //why is ...

Artem Stepin
Votes: 0
Answers: 2