首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

输出结果为何不是//14 13 12 8 4

2013-08-09 
输出结果为什么不是//14 13 12 8 4 ?#include stdafx.hint a_set[4][4] { 0,1,2,3,4,5,6,7,8,9,10,11,

输出结果为什么不是//14 13 12 8 4 ?


#include "stdafx.h"

int a_set[4][4] = { 
0,1,2,3,
4,5,6,7,
8,9,10,11,
12,13,14,15
};

void Matrix_sh(int (*p)[4]){ 
int top_s = 2;
int bottom_s = 3; 

for(int m =bottom_s;m>0;m--){
printf("%d ",p[4][m]);
}
for(int z =top_s;z>0;z--){
printf("%d ",p[z][0]);
}
printf("\n");
}

int _tmain(int argc, _TCHAR* argv[]){
Matrix_sh(a_set);
return 0;



[解决办法]
 printf("%d ",p[4][m])//越界了,改为p[3][m]

热点排行