Wrong value with strcpy

Hello, I am trying to copy a single character from a char array into a char variable using strcpy. The char array represents key values of a alphanumerical keypad.

However, the result is not what I intended.

char keys[10][5]  {{'0','X','Y','Z','e'},
                   {'1','A',' ','-','e'},
                   {'2','B','C','D','e'},
                   {'3','E','/','.','e'},
                   {'4','F','G','H','e'},
                   {'5','I','J','K','e'},
                   {'6','L','M','N','e'},
                   {'7','O','P','Q','e'},
                   {'8','R','S','T','e'},
                   {'9','U','V','W','e'}                  
                   };

//---------------------------------------------------Test

Serial.println(keys[2][0]);   // prints a 2 as intended
char bingo[9];
strcpy(bingo,keys[2][0]);
Serial.println(bingo);          // prints not a 2 but some gibberish

I am guessing in the first print command keys[2][0] is giving the value stored at that location, in the strcpy command keys[2][0] is interpreted differently. But why?

What do I need to change in order that char bingo receives the value '2' ?

What do I need to change in order that char bingo receives the value '2' ?

char bingo = keys[2][0];

The strcpy() function only works on null terminated character arrays. Your arrays are not null terminated so the function knows not where to stop copying, hence garbage.

Oh, cool, I understand in general. Thanks.

However, your suggestion does not compile because

incompatible types in assignment of 'char' to 'char [9]'

and I would run in the same problem when I add additional keystrokes to char bingo using strcat().

I got it solved though this way by adding the \o terminator.

//---------------------------------------------------Test
Serial.println(keys[2][0]);     // prints a 2 as intended
char bingo[9];
char bongo[2]= {'1','\0'};
bongo[0] = keys[2][0];
strcpy(bingo,bongo);
bongo[0] = keys[5][0];
strcat(bingo,bongo);
Serial.println(bingo);            // now prints 25 as intended

Thanks for putting me on the right track. :)

However, your suggestion does not compile because

incompatible types in assignment of 'char' to 'char [9]'

Nonsense. groundFungus's example redefined the type of bingo. You didn't implement the example correctly.