There is not enough room in your array to hold "alpha". The C-string "alpha" ends with an additional '\0'(NUL)-character and thus needs 6 chars in the array. char choice[2][6]={"alpha","beta"}; should work.

There is not enough room in your array to hold "alpha". The C-string "alpha" ends with an additional '\0'(NUL)-character and thus needs 6 chars in the array. char choice[2][6]={"alpha","beta"}; should work.

Thanks a lot Caligulaminus, it worked. I thought that, since "alpha" is held from choice[0][0] to choice[0][4], choice[0][5] should hold the null character.