You can also use the memset () function, which can set the entire array to a specified value byte by byte. Memset () functions are declared in string.h and mem.h header files. It takes the starting address of the array as its first parameter, the second parameter is to set the value of each byte of the array, and the third parameter is the length of the array (the number of bytes, not the number of elements). Its functional prototype is:
void *memset(void*,int,unsigned);
Where void* represents the starting address, int represents the value to be filled, and the last unsigned one represents the number of bytes filled.
For example:
# include & ltstring.h & gt
void main()
{
int a[ 10][20]= { 0 }; //method 1, all initialized to 0.
int * p[ 10][20]= { NULL };
char c[ 10][20]= { ' \ 0 ' };
Double b [50] [200]};
memset(b,0,sizeof(b)); //Method 2, all initialization is 0.
}