C³ÌÐòÎÊÌâ
ÓÐÕâÑùÁ½¸öÎÊÌ⣬ϣÍû¸ßÊÖÖ¸µã£º
µÚÒ»£º
struct struct_A{
int a;
char b;
int c;
short d;
}
struct struct_B{
int a;
char b;
short c;
int d;
}
struct_A a;
struct _B b;
ÎÊ£ºsizeof(struct_A a) = ?
sizeof(struct_A b) = ?
´ð°¸£ºsizeof(a) Ϊ16£¬sizeof(struct_A b)Ϊ12
ΪʲôÊÇ 16 ºÍ 12 ÄØ£¿
µÚ¶þ£º
fnxxxx_max(char str[])
{
putchar str[0];
str++; //(1)
printf(¡°%s¡±,str);
}
main()
{
char str[20]={¡°ABCDEFG¡±};
fnxxxx_max(str);
str++; //(2)
printf(¡°%s¡±,str);
}
ÎÊ£ºÓï¾ä£¨1£©ºÍÓï¾ä£¨2£©ÊÇ·ñ³ÉÁ¢£¿
´ð°¸£ºÓï¾ä£¨1£©³ÉÁ¢£¬Óï¾ä£¨2£©²»³ÉÁ¢
Óï¾ä£¨1£©ºÍ£¨2£©µÄstrÇø±ðÔÚÄÄÀ
µÚÒ»¸öÎÊÌâÄã²éÏ¡°×Ö½Ú¶ÔÆ롱
ÎÊÌâ1:ÄÚ´æ²¹Æë
ÎÊÌâ2£ºÖ¸ÕëºÍÍË»¯ÎªÖ¸ÕëµÄÊý×éÃû£¬Ö¸Õë¿ÉÒÔÂÒÖ¸£¬Êý×鵱Ȼ²»ÐУ¬ÍË»¯ÁËÒ²²»ÐÐ
Èç¹ûÒ»°ã¶¼ÊÇ4×Ö½Ú¶ÔÆëµÄ£¬ÄÇ¡°sizeof(struct_A b)Ϊ12 ¡±ÎªÊ²Ã´ÊÇ12 ¶ø²»ÊÇ16ÄØ£¿
¶ÔÆë²»Ò»¶¨ÊÇÿ¸ö³ÉÔ±ÒªÕ¼Ò»ÑùµÄ¿Õ¼ä£¬¶øÊÇÒª·½±ãÑ°Ö·£¬¾ßÌå¹æÔòÀÏʵ˵¼ÇµÃ²»ÊǺÜÇå³þ£¬Â¥Ö÷¿ÉgoogleÒ»ÏÂ
ÎÊÌâ1
Ê×ÏÈÄãÒªÖªµÀ£¬½á¹¹ÌåÊÇ°´
Ïà¹ØÎÊ´ð£º
¹«Ë¾¿ª·¢Ò»¸ö´¥ÃþÆÁ³ÌÐò£¬ÎÒ¸ºÔðµÄÒ»¿é£¬ÊµÏÖÕâÑùÒ»¸ö¹¦ÄÜ£¬µ±Êó±êµã»÷´°¿ÚÖÐͼƬ£¨Ò»ÕÅͼ·Ö³É¼¸²¿·Ö£©µÄÆäÖÐÒ»²¿·Öʱ£¬½«Õⲿ·ÖͼƬ½ØÈ¡³öÀ´£¬µ¯³öеĴ°¿Ú£¬½«½ØÈ¡³öµÄͼƬÏÔʾ³öÀ´¡£ÎÒʹÓÃRectangeÀà¿ØÖÆÁË·µ»Ø£¬ ......
ÔھƵê¹ÜÀíϵͳÖÐ,ÓÐÒ»¸ö¶ÔÄÚµÄϵͳ,¹©Ç°Ì¨·þÎñÔ±ºÍ¾ÀíʹÓÃ
»¹ÓÐÒ»¸ö¾ÍÊǶÔÍâ,Èÿͻ§¿ÉÒÔÔÚÍøÉÏÔ¤¶©·¿¼ä,
ËüÃÇÖ®¼äÊÇÔõôͨѶµÄ.?µ±ÎÒÌá½»Ô¤¶©·¿¼äÐÅÏ¢µÄʱºò,
ÔÚ¶ÔÄÚµÄϵͳÖÐ,ÈçºÎÖªµÀÎÒÒѾÌá½»ÁËÐÅÏ¢¹ýÈ¥.Ê¹Ç ......
ÎÒ¸Õ°ÑÌ·ºÆÇ¿µÄµÚÈý°æµÄÊéѧÍ꣬ÎÒÖªµÀµÄÓÐC++£¬CºÍÖ¸Õë CȱÏݺÍÏÝÚå Cר¼Ò±ä³É£¬»¹ÓÐÊý¾Ý½á¹¹£¬ÎÒÏëÎÊÎÊÎÒÓ¦¸ÃÒÔʲô˳ÐòÀ´Ñ§ÄØ
CȱÏݺÍÏÝÚå Cר¼Ò±à³Ì
Êǽø½×µÄ£¬²»Óü±×Å¿´
ÖÁÓÚ
CºÍÖ¸Õë
Äã²»Àí½âÖ ......
ÎÒÃǵÄCÓïÑԿζ¼½áÁË¡£¸Ð¾õÀÏʦºÃÏñʲô¶¼Ã»½²ËƵġ£
ÒÔºó¾Í²»»á¿ª¿ÎÁË¡£ÎÒ»¹Ïë¼ÌÐøѧC£¬ÒªÔõôѧ²Å¸ßЧÇÒÇáËÉÄØ£¿
C¶ÔÊýѧҪÇóºÜ¸ßÂð£¿ÊýѧÀÏʦ½²¿Î×ÜÊÇ˵£º£º¡°Õâ¸ö¹«Ê½¶ÔÄãÃǼÆËã»úרҵµÄºÜÖØÒªµÄ£¡¡±¡£¿ÉÊÇÎÒà ......