Keypad question (aliasing button names)

Dumb question but here it goes:

I have a keypad setup like this

[code]

char keys[ROWS][COLS] = {
  {
    '1', '2', '3', 'MENU', 'MORE'
  }
  ,
  {
    '4', '5', '6', 'Pesc', 'z'
  }
  ,  
  {
    '7', '8', '9', 'Enter', 'f_three)'
  }
  , 
  {
    '*', '0', '#', 'SQL', 'Ftwo'
  }
  ,
  {
    'Fone', 'upperSb', 'LowerSB', 'arrowDown', 'arrowuP'
  }
};

When using an IF statement I have to use the last character of the button name. Example:

 if (key == 'e') {   // must use e instead of F_one
      indexAccumulator++;
}

What is the proper procedure for establishing meaningful button names beyond 1-9,#,* etc... and utilize them within the code? Thanks[/code]

mancow: Dumb question but here it goes:

I have a keypad setup like this

char keys[ROWS][COLS] = {
  {
    '1', '2', '3', 'MENU', 'MORE'
  }
  ,
  {
    '4', '5', '6', 'Pesc', 'z'
  }
  ,  
  {
    '7', '8', '9', 'Enter', 'f_three)'
  }
  , 
  {
    '*', '0', '#', 'SQL', 'Ftwo'
  }
  ,
  {
    'Fone', 'upperSb', 'LowerSB', 'arrowDown', 'arrowuP'
  }
};

When using an IF statement I have to use the last character of the button name. Example:

 if (key == 'e') {   // must use e instead of F_one
      indexAccumulator++;
}

Single quotes denote a single character. "F_one" is a string, not a single character.

What is the proper procedure for establishing meaningful button names beyond 1-9,#,* etc... and utilize them within the code? Thanks

Constants:

const char F_ONE =0;
const char MENU = 1;
const char MORE = 2;
...
char keys[ROWS][COLS] = {
  {
    '1', '2', '3', MENU, MORE
  }
...
if (key == F_ONE)
{
  ...

HazardsMind:

define might be better

Functionally the same, but const gives the added benefit of not potentially screwing up in cases where there are type differences.

Example:

define car 3

char * msg = "racecar"; . . . Serial.print(msg); // race3

No. Printing msg will result in racecar being printed. Token substitution happens, not substring substitution. "racercar" is a token. msg is s token. car is a token. The car in "racecar" is a substring.

I figured, I wasn't able to test it when I put it up. Post deleted.

Arrch has the right idea, I think, but if you happen to be using the KeyPad library, you probably want to avoid using 0, since that library returns 0 when no key has been pressed.

Thanks guys I will try the suggestions and see how I make out.