Is There a Way to Increment and Scroll through Declared Variables?


something i've been wondering couple months, took long way around avoid being held it.

i want have program cycle through declared variables , read values code. better describe it, along lines of i'd do:

code: [select]

//declare arrays, same "myarray" beginning, different numbers on tail.
int myarray1 = {1,2,3};
int myarray2 = {4,5,6};
int myarray3 = {7,8,9};

void loop {

myarray++; //this part doesn't work

if (myarray[1] == 5) { serial.print("must array #2!"); }

}



this example code more complex, needless say. want have seemingly infinite amount of arrays, declaring them not time consuming not proper solution. can add guidance on how go doing this? figure there must way, honest i'm not sure i'm looking (so sorry if has been asked before). in advance guys!

the typical way want put pointers arrays table:

code: [select]

int myarray1[] = {1,2,3};
int myarray2[] = {4,5,6};
int myarray3[] = {7,8,9};

const int * (myarray[]) = {myarray1, myarray2, myarray3};


note: c++ arrays start index 0 myarray[0] points myarray1.  can confusing might want name arrays starting 0.



Arduino Forum > Using Arduino > Programming Questions > Is There a Way to Increment and Scroll through Declared Variables?


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support