30 ms·
in the loop, you set cp[i] to a reference to the variable value. value is the same variable through the loop, with different values copied inside it, first A th
by makapuf 5y ago
in the loop, you set cp[i] to a reference to the variable value.
value is the same variable through the loop, with different values copied inside it, first A then B then C.
So at the end you have cp having three times a reference to value, with the last value in it, namely C.