*solved* output the changed element from an array
in
Programming Questions
•
5 months ago
Hi.
I have an array of 3 numbers.
I would like to output only elements that have changed between fame -1 and frame.
I made another array to track changes from my source array.
but weird nothing occurs…
here's what I got:
any help would be cool !
thanks
I have an array of 3 numbers.
I would like to output only elements that have changed between fame -1 and frame.
I made another array to track changes from my source array.
but weird nothing occurs…
here's what I got:
any help would be cool !
thanks
- //mousePressed modify the source array, and it should println the changed element…but walou…
int[] source= {
3, 4, 5
};
int track_source[] = new int[3];
void setup()
{
size(300, 300);
track_source= source;
}
void draw()
{
background(200);
for (int i =0; i<3; i++)
{
if (track_source[i] !=source[i] )
{
println(source[i]);
track_source[i] =source[i] ;
}
}
}
void mousePressed()
{
source[1] = 19;
}
1