Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C/C++³ÌÐòÖнṹÌå×Ö½ÚÁ÷µÄÍøÂç´«Êä

 ¾­³£ÐèÒªÔÚ³ÌÐòÖн«Ô¶³Ì´«À´µÄ×Ö½ÚÁ÷½øÐнṹ»¯£¬»òÕß½«½á¹¹»¯µÄÊý¾Ý±ä³É×Ö½ÚÁ÷´«¸øÔ¶³ÌÖ÷»ú¡£ÔÚC/C++³ÌÐòÖУ¬½á¹¹»¯Êý¾Ýͨ³£ÓýṹÌåÀ´×éÖ¯£¬½á¹¹ÌåÒ²Äܹ»·½±ãµÄת»»Îª×Ö½ÚÁ÷£¬Òò´Ë½á¹¹»¯µÄÊý¾Ý´«Êä±¾²»¸Ã³ÉΪÎÊÌ⣬µ«ÔÚVC»òGCCµÄĬÈÏÉèÖÃϱàÒë³öµÄ³ÌÐò£¬È´ÓÐÒ»¸öÖµµÃ×¢ÒâµÄÎÊÌâ——½á¹¹ÌåµÄ¶ÔÆë¡£    ½á¹¹ÌåµÄ¶ÔÆëÊDZàÒëÆ÷Ϊ¼Ó¿ì³ÌÐòÔËÐУ¬ÔڽṹÌåÖÐÌîÈëһЩ¿Õ°××Ö½Ú£¬ÊǵĽṹÌå³ÉÔ±°´Ò»¶¨¹æÔò¶ÔÆë¡£
ÀýÈç½á¹¹£º 
struct MyStruct
{    
char a;    
int  b; 
};
  
     °´Ò»°ã¼ÆËãÆäÀàÏ´¹ýÄÇ´óСӦΪ5¸ö×Ö½Ú£¬µ«ÔÚÉÏÊö±àÒëÆ÷ĬÈÏÉèÖÃÏ£¬Ê¹ÓÃsizeof¼ÆËã³öµÄ½á¹¹ÌåÀàÐÍ´óСΪ8¸ö×Ö½Ú£¬ÒòΪ±àÒëÆ÷ÔڸýṹµÄµÚÒ»¸ö³ÉÔ±ºóÌîÈëÁË3¸ö×Ö½ÚÀ´±£³Ö³ÉÔ±µÄ¶ÔÆë¡£ÕâÑù£¬ÔÚÐòÁл¯×Ö½ÚÁ÷µÄʱºò¾Í²úÉúÁËÎÊÌ⣬¸Ã½á¹¹ÀàÐ͵ıäÁ¿Ö¸ÕëÖ±½Óת»¯³Échar *»òÕßʹÓÃmemcpyµÃ³öµÄ×Ö½ÚÁ÷¼´Îª8¸ö×Ö½Ú¶ø·Ç5¸ö×Ö½Ú¡£Ò»°ãÇé¿öÏ£¬´«Êä¹æÔ¼Ö»¶¨ÒåÓÐЧ×Ö½Ú£¬Òò¶øÉÏÊö·½Ê½²úÉúµÄ×Ö½ÚÁ÷ÖÐ3¸ö×Ö½Ú½«²»ÔÚ¹æÔ¼Öж¨Ò壬Òò´ËÔ¶³ÌÖ÷»úÔÚ½âÎöµÄʱºò»á²úÉúÎó½â£¬µ±È»³ý·ÇÔ¶³Ì½âÎö³ÌÐò²ÉÓÃͬÑùµÄÐòÁл¯·½Ê½ºÍͬÑùµÄ½á¹¹¶ÔÆëÉèÖ㬶øÕâÔÚijЩÇé¿öÏÂÄÑÒÔ±£Ö¤¡£ËùÒÔ£¬ÔڽṹµÄÐòÁл¯¹ý³ÌÖУ¬±ØÐë½ö´¦ÀíÓÐЧ×Ö½Ú£¬Ê¹µÃ×Ö½ÚÁ÷·ûºÏ¹æÔ¼¶¨Òå¡£
    ¶àÓà×ֽڵIJúÉúÔ­ÒòÔÚÓÚ±àÒëÆ÷¶Ô½á¹¹Ìå³ÉÔ±¶ÔÆë×Ö½ÚÊýµÄÉèÖõIJ»Í¬£¬VCºÍGCC(MinGW)µÄĬÈÏÉèÖÃΪ8×Ö½Ú¶ÔÆ룬ËùÒÔÐèÒª¸Ä±äÆäĬÈϵĶÔÆë×Ö½ÚÊýΪ°´µ¥×Ö½Ú¶ÔÆ룬¼´¿ÉÒÔ½â¾öÉÏÊöÎÊÌâ¡£¾ßÌå·½·¨ÊÇÔÚ´úÂëÍ·ÖмÓÈë: 
   #pragma pack(1)¼´¿É¡£
   ´ËºóʹÓÃsizeof¼ÆËã³öµÄ½á¹¹Ìå´óС¼´Îª¸÷³ÉÔ±´óСµÄ×ܺ͡£ÕâÔÚ°´¼È¶¨¹æÔ¼±àдÍøÂç¶þ½øÖÆÊý¾Ý´«Êä³ÌÐòʱÐèҪעÒâ¡£


Ïà¹ØÎĵµ£º

»ñÈ¡IPµÄC ´úÂë

»ñÈ¡IPµÄC ´úÂë #include<stdio.h> #include<winsock2.h> #pragma comment(lib,"ws2_32.lib") void CheckIP(void) //¶¨ÒåCheckIP£¨£©º¯Êý£¬ÓÃÓÚ»ñÈ¡±¾»úIPµØÖ· { WSADATA wsaData; char name[255]; //¶¨ÒåÓà ...
»ñÈ¡IPµÄC ´úÂë
#include<stdio.h>
#include<winsock2.h>
#pragma comment(li ......

c/c++ÖеÄconst¹Ø¼ü×Ö

const£¬c\c++Öзdz£³£ÓõĹؼü×Ö¡£
Ê×ÏÈÎÒÃÇ¿´¿´constÓÐÄÇЩÐÞÊη½·¨¡£
×îÇ°ÃæÎÒÃÇÀ´¿´Ò»¸öÎÊÌâ¡£
char *p = "123";
¿ÉÄÜÓеÄÈ˲»ÖªµÀ£¬ÕâÀïµÄÕâ¸ö"123"ÊÇ´æ´¢ÔÚ³£Á¿ÇøµÄ£¬²»ÈÝÐíÐ޸ĵġ£
Ò²¾ÍÊÇ˵ËüÊǸöconstÀàÐ͵ġ£
±ê×¼µÄд·¨Ó¦¸ÃÊÇ
char const *p = "123";
ÖÁÓÚΪʲô±àÒëÆ÷ÈÝÐíÉÏÃæµÄÄǸö²»±ê×¼µÄд·¨£¬¿ÉÄ ......

cÏÝÚåÓëȱÏÝѧϰ±Ê¼Ç

http://c.chinaitlab.com/c/basic/200907/789321.html
  ´Ê·¨ÏÝÚ壺
    1        = ²»Í¬ÓÚ£½£½²»ÒªÔÚ³ÌÐòÖн«Á½Õßд´í£¬Ð¡ÐÄ¡£½«±í´ïʽÓë³£Á¿±È½Ïʱ£¬¿É½«³£Á¿·ÅÔÚ×ó±ß¡£
    2        &ºÍ| ²»Í¬ÓÚ& ......

ÈçºÎÀí½âcºÍc++µÄ¸´ÔÓÀàÐÍÉùÃ÷

 Ôø¾­Åöµ½¹ýÈÃÄãÃԻ󲻽⡢ÀàËÆÓÚint * (* (*fp1) (int) ) [10];ÕâÑùµÄ±äÁ¿ÉùÃ÷Âð£¿
±¾ÎĽ«ÓÉÒ×µ½ÄÑ£¬Ò»²½Ò»²½½Ì»áÄãÈçºÎÀí½âÕâÖÖ¸´ÔÓµÄC/C++ÉùÃ÷¡£
ÎÒÃǽ«´ÓÿÌ춼ÄÜÅöµ½µÄ½Ï¼òµ¥µÄÉùÃ÷ÈëÊÖ£¬È»ºóÖð²½¼ÓÈëconstÐÞÊηûºÍtypedef£¬»¹Óк¯ÊýÖ¸Õ룬×îºó½éÉÜÒ»¸öÄܹ»ÈÃÄã׼ȷµØÀí½âÈκÎC/C++ÉùÃ÷µÄ“ÓÒ×ó·¨Ôò&rdquo ......

C/C++ÕÐƸµÄһЩ¸ÐÊܺ;­Ñé

C/C++ÕÐƸµÄһЩ¸ÐÊܺ;­Ñé
Ç°¶Îʱ¼ä¸Õ²Î¼ÓÁËn¶à¹«Ë¾µÄC/C++Èí¼þ¹¤³ÌʦµÄÃæÊÔ£¬ÓйúÆó£¬ÍâÆó£¬Ë½Æó£¨moto£¬·É˼¿¨¶û£¬¸ÛÍ壬ÖйúÎÀÐÇXXX£¨Õâ¸öÅ££©£©µÈµÈµÈµÈ¡£¸ÐÊܸÐÏëÆĶ࣬½üÈÕÖÕÓÚ¿ÕÏУ¬Ôڴ˱íÊöһϡ£
±¾ÈË»ù±¾Ìõ¼þ£º3Ä꿪·¢¾­Ñ飬2year+ Windows development experence£¬1year+ Linux experence. ÊìϤC£¬C++£¬MFC/ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ