I don't know if I'm misreading your question or whether it really is as straight forward as finding the size of your 5 * 10 * 20 character array? The sizeof type char is 1-byte per-char. Thus 5 * 10 * 20 = 1000 (as compared to say a type int which would normally be 4-bytes per-int).
To determine the size within the scope where the array is statically declared you can use the sizeof operator, for example:
#include <stdio.h>
int main (void) {
char c[5][10][20];
printf ("\n sizeof c : %lu\n\n", sizeof c);
return 0;
}
Use/Output
$ ./bin/sizeof_3d
sizeof c : 1000
To set each element in the array to ' ' (space), you have a couple of options (1) a loop over each element in the array; or (2) using memset. To use a loop:
size_t i, j, k;
...
for (i = 0; i < 5; i++)
for (j = 0; j < 10; j++)
for (k = 0; k < 20; k++)
c[i][j][k] = ' ';
If you need a literal string of blanks you will need to add a nul-terminating character as the final character in each string. When using the loop above, that can be accomplished by replacing c[i][j][k] = ' '; with the following that uses a ternary operator to write a nul-character (zero) as the final character in each string:
c[i][j][k] = k + 1 == 20 ? 0 : ' ';
To use memset (don't forget to #include <string.h>):
memset (c, ' ', sizeof c);
To null terminate following the use of memset, an abbreviated loop can be used:
size_t i, j, k;
...
memset (c, ' ', sizeof c);
for (i = 0; i < 5; i++)
for (j = 0; j < 10; j++)
c[i][j][19] = 0;
Let me know if you have further questions.