I want to initialize all elements of:
char buffer[1000][1000];
to ' '.
I’ve tried
char buffer[1000][1000] = { ' ' };
and
char buffer[1000][1000] = { { ' ' } };
but both ways only seem to initialize only the first term.
I am willing to consider alternative approaches that get the job done, but I would prefer to avoid writing in this kind of initialization code in main, or even a separate initialization method.
If the array has automatic storage duration, consider heap-allocation to avoid overflowing the stack.
If the array has static storage duration, you’ll still need to initialize the array at runtime as there’s no way to initialize elements with a non-zero value without providing a separate initialization value for each of them.