荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: bigone (Everything is nothing.), 信区: Program
标  题: Re: 再看
发信站: 荔园晨风BBS站 (Wed Nov 13 17:38:00 2002), 站内信件

<<The C Programing Language>>:
        Because of alignment requirements for different objects,there

        may be unnamed "holes" in a structure.For instance, if a 'char'

        is one byte and an 'int' four bytes,the structure

                struct {
                        char c;
                        int  i;
                }
        might will require eight bytes, not five.



【 在 leebilly (丫,我不哭) 的大作中提到: 】
: 这条也是面试题:
: typedef struct{
:   char c1;
:   char c2;
:   int  n;
: }stru;
: 问sizeof(stru)等于多少?请说明理由。
: ps:关键是理由。


--
※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.1.49]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店