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

大侠帮小弟我看看这个变量是什么类型

2012-09-06 
大侠帮我看看这个变量是什么类型.有个不明白是什么类型的变量,代码如下(来自Zlib):1:C/C++ codestruct int

大侠帮我看看这个变量是什么类型.
有个不明白是什么类型的变量,代码如下(来自Zlib):

1:

C/C++ code
struct internal_state;typedef struct z_stream_s {    Bytef    *next_in;  /* next input byte */    uInt     avail_in;  /* number of bytes available at next_in */    uLong    total_in;  /* total nb of input bytes read so far */    Bytef    *next_out; /* next output byte should be put there */    uInt     avail_out; /* remaining free space at next_out */    uLong    total_out; /* total nb of bytes output so far */    char     *msg;      /* last error message, NULL if no error */    struct internal_state FAR *state; /* 这里的*state声明的是internal_state类型,问题是上面就定义了一个struct internal_state 请问这个*state是什么类型的 */    alloc_func zalloc;  /* used to allocate the internal state */    free_func  zfree;   /* used to free the internal state */    voidpf     opaque;  /* private data object passed to zalloc and zfree */    int     data_type;  /* best guess about the data type: binary or text */    uLong   adler;      /* adler32 value of the uncompressed data */    uLong   reserved;   /* reserved for future use */} z_stream;


还有,为什么这个类型定义时的名称是z_stream_s,结束定义时是z_stream?


[解决办法]
typedef struct z_stream_s {

..........

} z_stream;
(typedef 结束定义的z_stream 与z_stream_s 是标示着同一个结构体,就相当于给上面的结构体又定义一个名字,如果结尾处是 *z_stream 在使用的时候就代表是结构体指针。 )

热点排行