Char can only hold one symbol. '51' is two symbols. It could be three if you would write it between double brackets ("51") because C-type strings are always finished with \0
. To hold more than one symbol you should use char pointers and double brackets or access them differently using one dimension:
char* array[3] = {"one", "two", "three"};
char string[3][7] = {"one", "two", "three"};
The second line tells that 3 string containing at most 7 characters (including \0
) can be used. I've chose such a number because "three" consists of 6 symbols.