Each string literal has additional character - terminating zero. So your array shall be declared as
char Map[10][11];
because it is initialized by string literal "##########" that has in total 11 characters (including the terminating zero).
Last edited on
"##########"
doesn't contain 10 characters. It contains 11.
There's a hidden '\0' character added to the end, so it actually looks like this:
{'#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '\0'}
'\0' is called the NUL character, and it's used as a hint where the array ends.
Thank you for the help vlad and Catfish
Last edited on