老同志,旧问题!
请先看如下代码:
#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 ]定义的是一维呀,可这个程序编译是正确的。应该如何理解这句宏定义?