Question: I have an array:

```
char array[4][4][2];

```

What i want is a table 4x4, that allocate a string of two characters on each position. But, when i initialize the array like that:

```
char array[4][4][2] = {{"AA", "BB","  ", "  "}, {"CC", "DD", "  ", "  "}, {"EE","FF","  ","  "}};

```

And make:

```
printf("%s\n", array[0][0]);

```

The output is:

```
AABB    CCDD    EEFF 

```

So, what's the right order to do that? I didn't find it anywhere.

Answer: 
A string in C requires a terminator, `'\0'`. So a 2-character array is too small for a string with two visible characters.

It's a feature of C's string array initialization that you don't get a warning or error for doing what you do; as often in C it's assumed that you know what you're doing.

If you do:

```
char foo[] = "foo";

```

you will get a four-character array with a terminator appended automatically, but if you do

```
char bar[3] = "bar";

```

you won't get a terminator since it doesn't fit, but you will not get an error either.

To fix it, increase the third size to `[3]` to make room for the terminator.

Many programmers would probably implement this instead as a 2D array of character pointers, but that uses a lot more memory than your design. It does buy you simplicity though:

```
const char *array[2][2] = { { "AA", "BB" }, { "CC", "DD" } };

```

This will make the compiler put the actual character data, with terminator characters added, *somewhere* in memory, and `array` will simply be a 2x2 array of pointers to the proper locations for the start of each string.
Try the following:

```
int ii, jj;
const char *array[2][2] = {{"hello", "world"},{"these are", "strings"}};
for (ii=0; ii<2; ii++) {
  for (jj=0; jj<2; jj++) {
    printf("%s\n", array[ii][jj]);
  }
}

```

This shows you how to properly allocate a 2D array of strings - you don't determine the size of each string, it is determined by the initialization. The compiler will make sure they are null terminated and everything - and they don't even need to be all the same size.

Note - what I actually did was create a 2D array of pointers, rather than a 3D array of characters. This is more flexible, and more appropriate to your case, since you appear to be interested in strings (which are arrays of characters, but are referenced by pointing to their start; and as @unwind pointed out, they need to be null terminated).