Return one array value - take array name from variable
hello, right trying this.
i expect return row[column];
for example
should output
but doesn´t work. output empty.
code: [select]
int give_number(char row[], int column){
int n0[]={1,1,1,1,1,1,1};
int n1[]={1,1,1,1,1,1,1};
int n2[]={0,1,1,1,1,0,1};
int n3[]={0,1,1,1,0,1,1};
int n4[]={1,1,1,1,0,1,0};
int n5[]={1,1,0,1,0,1,1};
int n6[]={1,0,1,1,1,1,1};
int n7[]={1,1,1,1,1,0,1};
int n8[]={1,1,1,1,1,1,1};
int n9[]={1,1,1,1,0,1,1};
return row[column];
}
i expect return row[column];
for example
code: [select]
int test=give_number("n2",2);
should output
code: [select]
test=1
but doesn´t work. output empty.
variable "names" don't exist @ run time. in fact, don't exist @ except in code. compiler turn references variable "names" storage places in memory.
you achieve similar using multi-dimensional arrays.
you achieve similar using multi-dimensional arrays.
Arduino Forum > Using Arduino > Programming Questions > Return one array value - take array name from variable
arduino
Comments
Post a Comment