C语言中需要遍历二维数组中元素时,若不考虑其他因素,建议外循环遍历列而内循环遍历行,因为在C语言中用的是以行序为主的存储结构。
for(int i=0;i<column;i++){
for(int j=0;j<row;j++){
/*Your codes to visit elements*/
}
}
![](https://img-my.csdn.net/uploads/201304/26/1366912753_6698.png)
C语言中需要遍历二维数组中元素时,若不考虑其他因素,建议外循环遍历列而内循环遍历行,因为在C语言中用的是以行序为主的存储结构。
for(int i=0;i<column;i++){
for(int j=0;j<row;j++){
/*Your codes to visit elements*/
}
}