probalbly simple programming question regarding variable assignment
in
Programming Questions
•
1 year ago
Dear all,
maybe this is stupid question, but I can't get over it for hours now ...
Whats wrong with the following code? Everytime I run it, the result is, that also b[0] equals 2, but only a[0] was assigned ...
Thnaks in advance from
Christian (Austria)
maybe this is stupid question, but I can't get over it for hours now ...
Whats wrong with the following code? Everytime I run it, the result is, that also b[0] equals 2, but only a[0] was assigned ...
Thnaks in advance from
Christian (Austria)
- float[] anull= {0, 0};
Ball balla;
void setup()
{
balla = new Ball(anull, anull);
}
void draw()
{
balla.test();
stop();
}
class Ball {
float a[];
float b[];
Ball(float[] ain, float[] bin) {
a=ain;
b=bin;
}
void test() {
a[0]=2;
println (b[0]);
}
}
1