 # quick question

Hi, I need short and clear answer :)

This code is for example:

``````int pins= {2,3,4,5,6,7};
int cols= {pins,pins,pins};
int rows= {pins,pins,pins};
``````

If i want to acces pin 2 on arduino, do I have to write rows or rows. I don't know if I have to begin with 0 or 1 when using this things.

Zero.

Thank you!

It would have been quicker to write a short sketch to try it out than to ask a question here - never mind waiting for the answer.

Where has personal initiative gone? Or the inquiring mind?

...R

ur000s:
Hi, I need short and clear answer This code is for example:

``````int pins= {2,3,4,5,6,7};
``````

int cols= {pins,pins,pins};
int rows= {pins,pins,pins};

``````

If i want to acces pin 2 on arduino, do I have to write rows or rows.
I don't know if I have to begin with 0 or 1 when using this things.
``````

`pins` is undefined, so the code is broken already. The pins array has
valid indexes from 0 to 5 inclusive.

ur000s: If i want to acces pin 2 on arduino, do I have to write rows or rows.

Assuming that the numbers {2,3,4,5,6,7} refer to the actual Arduino pins, then Pin 2 is referenced by pins.

On the basis that you renumber you array indexes (from 1 -6 to 0-5) then rows will be your answer.

Cheers

MarkT: The line:

``````int pins= {2,3,4,5,6,7};
``````

is not broken. When an integer constant appears in brackets as part of a data definition, it defines the number of elements to be allocated in memory by the compiler...it is not an index into the array.

``````int cols= {pins,pins,pins};