我想在C语言中反复对一个大的2d数组进行调零.这就是我目前所做的:
// Array of size n * m, where n may not equal m
for(j = 0; j < n; j++)
{
for(i = 0; i < m; i++)
{
array[i][j] = 0;
}
}
我try 过使用Memset:
memset(array, 0, sizeof(array))
但这只适用于1Darray.当我打印2D数组的内容时,第一行是零,但随后我得到了一个随机大数负载,它崩溃了.