I want to initialize a two-dimensional array of variable size to zero.
I know it can be done for a fixed-sized array:
int myarray[10][10] = {0};
but it is not working if I do this:
int i = 10;
int j = 10;
int myarray[i][j] = {0};
Is there a one-line way of doing this or do I have to loop over each member of the array?
Thanks
You cannot initialize it with an initializer, but you can
memset()the array to 0.Note: this is
C99. InC89the declaration of m (int m[a][b];) is an error.