Pages: [1]   Go Down
Author Topic: Using i/o via an array  (Read 219 times)
0 Members and 1 Guest are viewing this topic.
NZ
Offline Offline
Jr. Member
**
Karma: 1
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to get my head around arrays in C.

I can do the following as to assign i/o pins via an array
int pins [6] = { 3, 5, 7, 10, 12, 13 }

However, can I assign a name to a pin and then use it in the array

const int Button1 = 3;
int pins [6] = { Button1, 5, 7, 10, 12, 13 }

thanks for any clarification

K
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 549
Posts: 46127
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
However, can I assign a name to a pin and then use it in the array
What did the compiler tell you?

If you didn't ask, why not?

If you had, it would have said something along the lines of "Success".
Logged

NZ
Offline Offline
Jr. Member
**
Karma: 1
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ha

I was so busy thinking about it, before buggering of to work, that I missed the obvious.

Cheers
Logged

Pages: [1]   Go Up
Jump to: