array prints weird stuff

edited July 2015 in Programming Questions

Hi, I have this simple code that does not work in my sketch. I have a function which creates and prints an array of 3 elements..but I don't understand why it will print weird stuff instead of the values stored inside of it

void makeChord(int tuning){

    float[] chord = new float[3];
    chord[0] = 10;
    chord[1] = 11;
    chord[2] = 12;
    println("CHORD "+chord);
}

will print something like

CHORD [F@704c6d5c
CHORD [F@299fec9d
CHORD [F@42674cc4
CHORD [F@be0f9eb
CHORD [F@436c8512

the function gets callend inside another function that's inside the draw. if I put this code in the draw, it will throw the same result. In a new sketch instead it will work fine. no errors in the console

same result also if I do this way

float[] chord = {10,10,10};
println("CHORD "+chord);

note that I have other arrays in the same sketch and they all work fine) thanks

Answers

Sign In or Register to comment.