老同志,旧问题!

yxlchw yxlchw 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
请先看如下代码:
#define BITS 15
#define MAX_CODE ( ( 1 << BITS ) - 1 )
#define TABLE_SIZE 35023L
#define TABLE_BANKS ( ( TABLE_SIZE >> 8 ) + 1 )
#define END_OF_STREAM 256
#define BUMP_CODE 257
#define FLUSH_CODE 258
#define FIRST_CODE 259
#define UNUSED -1

struct dictionary {
int code_value;
int parent_code;
char character;
} *dict[ TABLE_BANKS ];

#define DICT( i ) dict[ i >> 8 ][ i & 0xff ]

这是我在LZW算法中看到的代码片段,让我不能理解的是“#define DICT( i ) dict[ i >> 8 ][ i & 0xff ]”这一句,宏定义DICT(i)等价于dict[ i >> 8 ][ i & 0xff ],是个二维下标,但*dict[TABLE_BANKS ]定义的是一维呀,可这个程序编译是正确的。应该如何理解这句宏定义?
...全文
评论 6
收藏 已收藏
分享
返回顶部
yxlchw
C语言 70,039 成员 243,237 内容