A multidimensional array is an array elements of which are in turn arrays.
Let's consider your declaration
char names[2][5] = {"john","boy"};
You can introduce a type alias like
typedef char T[5];
so the name T
is an alias for the type char[5]
.
Now your initial declaration may be rewritten like
T names[2] = {"john","boy"};
That is you have an array of two elements which of them is in turn an array of the type char[5].
String literals are also have types of character arrays. For example the string literal "John" can be represented like
char john[5] = { 'J', 'o', 'h', 'n', '\0' };
elements of a string literal are used to initialize a corresponding character array.
So you array is initialized like
char names[2][5] = { { 'J', 'o', 'h', 'n', '\0' }, { 'b', 'o', 'y', '\0', '\0' } };
If a string literal contains less elements than the number of elements of the initialized array then all other elements of the array that have no an explicit initializer will be zero-initialized.