Error

C++博客 首页 新随笔 联系 聚合 管理
  217 Posts :: 61 Stories :: 32 Comments :: 0 Trackbacks
#define __LEN_NAME 8
#define __COUNT 4
struct tagTem
{
char nameList[__COUNT][__LEN_NAME];
};
#include <cstdlib>
#include <cstring>
int main()
{
tagTem tem;
memset(&tem, NULL, sizeof(tem));
int i = 0;
for (int y = 0; y < __COUNT; y++)
{
for (int x = 0; x < __LEN_NAME; x++)
{
tem.nameList[y][x] = x + (y << 4);
}
}


0x0018F6F0  00 01 02 03 04 05 06 07  ........
0x0018F6F8  10 11 12 13 14 15 16 17  ........
0x0018F700  20 21 22 23 24 25 26 27   !"#$%&'
0x0018F708  30 31 32 33 34 35 36 37  01234567
所以二维数组定义的时候是这样:char array[y][x];
原来之前我一直理解错了。。。
posted on 2016-07-08 16:05 Enic 阅读(238) 评论(0)  编辑 收藏 引用 所属分类: C/C++技巧

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理