¡¶[Ãâ·ÑÏÂÔØ cÓïÑÔÉî¶È½âÆÊ[1]¡·

ÏÂÔر¾Êé

Ìí¼ÓÊéÇ©

[Ãâ·ÑÏÂÔØ cÓïÑÔÉî¶È½âÆÊ[1]- µÚ10½Ú


°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
1¸ö¡¡
byte£¬0¡£5¸ö¡¡
byteÔõô´¦Àí£¿½â¾öÕâ¸öÎÊÌâµÄ×îºÃ
°ì·¨¾ÍÊÇÕÛÖУ¬±àÒëÆ÷ÀíËùµ±È»µÄÈÏΪÄã¹¹ÔìÒ»¸ö½á¹¹ÌåÊý¾ÝÀàÐÍÊÇÓÃÀ´´ò°üһЩÊý¾Ý³É
Ô±µÄ£¬¶ø×îСµÄÊý¾Ý³ÉÔ±ÐèÒª¡¡
1¸ö¡¡
byte£¬±àÒëÆ÷Ϊÿ¸ö½á¹¹ÌåÀàÐÍÊý¾ÝÖÁÉÙÔ¤Áô¡¡
1¸ö¡¡
byte
µÄ¿Õ¼ä¡£ËùÒÔ£¬¿Õ½á¹¹ÌåµÄ´óС¾Í¶¨Î»¡¡
1¸ö¡¡
byte¡£

1¡£14¡£2£¬ÈáÐÔÊý×é
Ò²ÐíÄã´ÓÀ´Ã»ÓÐÌý˵¹ýÈáÐÔÊý×飨flexiblearray£©Õâ¸ö¸ÅÄµ«ÊÇËüȷʵÊÇ´æÔڵġ£¡¡


C99ÖУ¬½á¹¹ÖеÄ×îºóÒ»¸öÔªËØÔÊÐíÊÇδ֪´óСµÄÊý×飬Õâ¾Í½Ð×öÈáÐÔÊý×é³ÉÔ±£¬µ«½á
¹¹ÖеÄÈáÐÔÊý×é³ÉԱǰÃæ±ØÐëÖÁÉÙÒ»¸öÆäËû³ÉÔ±¡£ÈáÐÔÊý×é³ÉÔ±ÔÊÐí½á¹¹Öаüº¬Ò»¸ö´óС¿É
±äµÄÊý×é¡£sizeof·µ»ØµÄÕâÖֽṹ´óС²»°üÀ¨ÈáÐÔÊý×éµÄÄÚ´æ¡£°üº¬ÈáÐÔÊý×é³ÉÔ±µÄ½á¹¹Óá¡
malloc£¨£©º¯Êý½øÐÐÄÚ´æµÄ¶¯Ì¬·ÖÅ䣬²¢ÇÒ·ÖÅäµÄÄÚ´æÓ¦¸Ã´óÓڽṹµÄ´óС£¬ÒÔÊÊÓ¦ÈáÐÔÊý×é
µÄÔ¤ÆÚ´óС¡£

ÈáÐÔÊý×éµ½µ×ÈçºÎʹÓÃÄØ£¿¿´ÏÂÃæÀý×Ó£º¡¡


typedefstructst_type¡¡


£û¡¡


inti£»¡¡


inta£§0£§£»¡¡


£ýtype_a£»

ÓÐЩ±àÒëÆ÷»á±¨´íÎÞ·¨±àÒë¿ÉÒԸijɣº¡¡


typedef¡¡
structst_type¡¡


£û¡¡


inti£»¡¡


inta£§£§£»¡¡


£ýtype_a£»
ÕâÑùÎÒÃǾͿÉÒÔ¶¨ÒåÒ»¸ö¿É±ä³¤µÄ½á¹¹Ì壬Óá¡
sizeof£¨type_a£©µÃµ½µÄÖ»ÓС¡
4£¬¾ÍÊÇ¡¡
sizeof£¨i£©=sizeof£¨int£©¡£ÄǸö¡¡
0¸öÔªËصÄÊý×éûÓÐÕ¼Óÿռ䣬¶øºóÎÒÃÇ¿ÉÒÔ½øÐб䳤²Ù×÷ÁË¡£Í¨
¹ýÈçϱí´ïʽ¸ø½á¹¹Ìå·ÖÅäÄڴ棺¡¡


type_a¡¡
*p¡¡
=£¨type_a*£©malloc£¨sizeof£¨type_a£©£«100*sizeof£¨int£©£©£»¡¡



ÕâÑùÎÒÃÇΪ½á¹¹ÌåÖ¸Õë¡¡
p·ÖÅäÁËÒ»¿éÄÚ´æ¡£Óá¡
p¡­¡·item£§n£§¾ÍÄܼòµ¥µØ·ÃÎʿɱ䳤ԪËØ¡£
µ«ÊÇÕâʱºòÎÒÃÇÔÙÓá¡
sizeof£¨*p£©²âÊԽṹÌåµÄ´óС£¬·¢ÏÖÈÔȻΪ¡¡
4¡£ÊDz»ÊǺܹîÒ죿ÎÒÃÇ
²»ÊǸøÕâ¸öÊý×é·ÖÅäÁË¿Õ¼äô£¿

±ð¼±£¬ÏÈ»ØÒäÒ»ÏÂÎÒÃÇÇ°Ãæ½²¹ýµÄ¡°Ä£×Ó¡±¡£ÔÚ¶¨ÒåÕâ¸ö½á¹¹ÌåµÄʱºò£¬Ä£×ӵĴóС¾Í
ÒѾ­È·¶¨²»°üº¬ÈáÐÔÊý×éµÄÄÚ´æ´óС¡£ÈáÐÔÊý×éÖ»ÊDZàÍâÈËÔ±£¬²»Õ¼½á¹¹ÌåµÄ±àÖÆ¡£Ö»ÊÇ˵
ÔÚʹÓÃÈáÐÔÊý×éʱÐèÒª°ÑËüµ±×÷½á¹¹ÌåµÄÒ»¸ö³ÉÔ±£¬½ö´Ë¶øÒÑ¡£ÔÙ˵°×µã£¬ÈáÐÔÊý×éÆäʵÓë
½á¹¹Ìåûʲô¹Øϵ£¬Ö»ÊÇ¡°¹ÒÑòÍ·Âô¹·È⡱¶øÒÑ£¬Ëã²»µÃ½á¹¹ÌåµÄÕýʽ³ÉÔ±¡£

ÐèҪ˵Ã÷µÄÊÇ£ºC89²»Ö§³ÖÕâÖÖ¶«Î÷£¬C99°ÑËü×÷ΪһÖÖÌØÀý¼ÓÈëÁ˱ê×¼¡£µ«ÊÇ£¬¡¡
C99
ËùÖ§³ÖµÄÊÇ¡¡
inpletetype£¬¶ø²»ÊÇ¡¡
zeroarray£¬ÐÎͬ¡¡
intitem£§0£§£»ÕâÖÖÐÎʽÊÇ·Ç·¨µÄ£¬C99Ö§
³ÖµÄÐÎʽÊÇÐÎͬ¡¡
intitem£§£§£»Ö»²»¹ýÓÐЩ±àÒëÆ÷°Ñ¡¡
intitem£§0£§£»×÷Ϊ·Ç±ê×¼À©Õ¹À´Ö§³Ö£¬¶øÇÒÔÚ¡¡
C99·¢²¼Ö®Ç°ÒѾ­ÓÐÁËÕâÖַDZê×¼À©Õ¹ÁË£¬C99·¢²¼Ö®ºó£¬ÓÐЩ±àÒëÆ÷°ÑÁ½Õߺ϶øΪһÁË¡£

µ±È»£¬ÉÏÃæ¼ÈÈ»Óá¡
mallocº¯Êý·ÖÅäÁËÄڴ棬¿Ï¶¨¾ÍÐèÒªÓá¡
freeº¯ÊýÀ´ÊÍ·ÅÄڴ棺¡¡


free£¨p£©£»

¾­¹ýÉÏÃæµÄ½²½â£¬ÏàÐÅÄãÒѾ­ÕÆÎÕÁËÕâ¸ö¿´ÆðÀ´ËƺõºÜÉñÃصĶ«Î÷¡£²»¹ýʵÔÚÒªÊÇû
ÕÆÎÕÒ²ÎÞËùν£¬Õâ¸ö¶«Î÷ʵÔÚºÜÉÙÓá£

1¡£14¡£3£¬structÓë¡¡
classµÄÇø±ð
ÔÚ¡¡
C£«£«Àï¡¡
struct¹Ø¼ü×ÖÓë¡¡
class¹Ø¼ü×ÖÒ»°ã¿ÉÒÔͨÓã¬Ö»ÓÐÒ»¸öºÜСµÄÇø±ð¡£¡¡
structµÄ³É
ԱĬÈÏÇé¿öÏÂÊôÐÔÊÇ¡¡
publicµÄ£¬¶ø¡¡
class³ÉԱȴÊÇ¡¡
privateµÄ¡£ºÜ¶àÈ˾õµÃ²»ºÃ¼Ç£¬ÆäʵºÜÈÝ
Òס£ÄãƽʱÓýṹÌåʱÓá¡
publicÐÞÊÎËüµÄ³ÉÔ±ÁËÂ𣿼ÈÈ»¡¡
struct¹Ø¼ü×ÖÓë¡¡
class¹Ø¼ü×Ö¿ÉÒÔ
ͨÓã¬ÄãÒ²²»ÒªÈÏΪ½á¹¹ÌåÄÚ²»Äܷź¯ÊýÁË¡£

µ±È»£¬¹ØÓڽṹÌåµÄÌÖÂÛԶûÓнáÊø£¬ÔÚÖ¸ÕëÓëÊý×éÄÇÒ»Õ£¬Ä㻹»áÒªºÍËü´ò½»µÀµÄ¡£

1¡£15£¬union¹Ø¼ü×Ö¡¡
union¹Ø¼ü×ÖµÄÓ÷¨Óë¡¡
structµÄÓ÷¨·Ç³£ÀàËÆ¡£¡¡


unionά»¤×ã¹»µÄ¿Õ¼äÀ´Ö÷Ŷà¸öÊý¾Ý³ÉÔ±Öеġ°Ò»ÖÖ¡±£¬¶ø²»ÊÇΪÿһ¸öÊý¾Ý³ÉÔ±ÅäÖÃ
¿Õ¼ä£¬ÔÚ¡¡
unionÖÐËùÓеÄÊý¾Ý³ÉÔ±¹²ÓÃÒ»¸ö¿Õ¼ä£¬Í¬Ò»Ê±¼äÖ»ÄÜ´¢´æÆäÖÐÒ»¸öÊý¾Ý³ÉÔ±£¬Ëù
ÓеÄÊý¾Ý³ÉÔ±¾ßÓÐÏàͬµÄÆðʼµØÖ·¡£Àý×ÓÈçÏ£º¡¡


unionStateMachine¡¡


£û¡¡
charcharacter£»¡¡
intnumber£»¡¡
char¡¡
*str£»¡¡
doubleexp£»¡¡


£ý£»
Ò»¸ö¡¡
unionÖ»ÅäÖÃÒ»¸ö×ã¹»´óµÄ¿Õ¼äÒÔÀ´ÈÝÄÉ×î´ó³¤¶ÈµÄÊý¾Ý³ÉÔ±£¬ÒÔÉÏÀý¶øÑÔ£¬×î´ó
³¤¶ÈÊÇ¡¡
doubleÐÍ̬£¬ËùÒÔ¡¡
StateMachineµÄ¿Õ¼ä´óС¾ÍÊÇ¡¡
doubleÊý¾ÝÀàÐ͵ĴóС¡£

ÔÚ¡¡
C£«£«ÀunionµÄ³ÉԱĬÈÏÊôÐÔҳΪ¡¡
public¡£unionÖ÷ÒªÓÃÀ´Ñ¹Ëõ¿Õ¼ä¡£Èç¹ûһЩÊý¾Ý


²»¿ÉÄÜÔÚͬһʱ¼äͬʱ±»Óõ½£¬Ôò¿ÉÒÔʹÓá¡
union¡£

1¡£15¡£1£¬´óС¶Ëģʽ¶Ô¡¡
unionÀàÐÍÊý¾ÝµÄÓ°Ïì
ÏÂÃæÔÙ¿´Ò»¸öÀý×Ó£º¡¡


union¡¡


£û¡¡
inti£»¡¡
char¡¡
a£§2£§£»¡¡


£ý*p£»u£»¡¡


p=&u£»¡¡
p¡­¡·a£§0£§¡¡
=¡¡
0x39£»¡¡
p¡­¡·a£§1£§¡¡
=0x38£»¡¡


p¡£iµÄÖµÓ¦¸ÃΪ¶àÉÙÄØ£¿
ÕâÀïÐèÒª¿¼ÂǴ洢ģʽ£º´ó¶ËģʽºÍС¶Ëģʽ¡£
´ó¶Ëģʽ£¨¡¡
Big_endian£©£º×ÖÊý¾ÝµÄ¸ß×Ö½Ú´æ´¢Ôڵ͵ØÖ·ÖУ¬¶ø×ÖÊý¾ÝµÄµÍ×Ö½ÚÔò´æ·Å
ÔڸߵØÖ·ÖС£
С¶Ëģʽ£¨¡¡
Little_endian£©£º×ÖÊý¾ÝµÄ¸ß×Ö½Ú´æ´¢ÔڸߵØÖ·ÖУ¬¶ø×ÖÊý¾ÝµÄµÍ×Ö½ÚÔò´æ·Å
Ôڵ͵ØÖ·ÖС£¡¡


unionÐÍÊý¾ÝËùÕ¼µÄ¿Õ¼äµÈÓÚÆä×î´óµÄ³ÉÔ±ËùÕ¼µÄ¿Õ¼ä¡£¶Ô¡¡
unionÐ͵ijÉÔ±µÄ´æÈ¡¶¼ÊÇ
Ïà¶ÔÓÚ¸ÃÁªºÏÌå»ùµØÖ·µÄÆ«ÒÆÁ¿Îª¡¡
0´¦¿ªÊ¼£¬Ò²¾ÍÊÇÁªºÏÌåµÄ·ÃÎʲ»ÂÛ¶ÔÄĸö±äÁ¿µÄ´æÈ¡¶¼
ÊÇ´Ó¡¡
unionµÄÊ×µØַλÖÿªÊ¼¡£Èç´ËÒ»½âÊÍ£¬ÉÏÃæµÄÎÊÌâÊÇ·ñÒѾ­ÓÐÁË´ð°¸ÄØ£¿

1¡£15¡£2£¬ÈçºÎÓóÌÐòÈ·Èϵ±Ç°ÏµÍ³µÄ´æ´¢Ä£Ê½£¿
ÉÏÊöÎÊÌâËƺõ»¹±È½Ï¼òµ¥£¬ÄÇÀ´¸öÓм¼Êõº¬Á¿µÄ£ºÇëдһ¸ö¡¡
Cº¯Êý£¬Èô´¦ÀíÆ÷ÊÇ¡¡


Big_endianµÄ£¬Ôò·µ»Ø¡¡
0£»ÈôÊÇ¡¡
Little_endianµÄ£¬Ôò·µ»Ø¡¡
1¡£
ÏÈ·ÖÎöһϣ¬°´ÕÕÉÏÃæ¹ØÓÚ´óС¶ËģʽµÄ¶¨Ò壬¼ÙÉè¡¡
intÀàÐͱäÁ¿¡¡
i±»³õʼ»¯Îª¡¡
1¡£
ÒÔ´ó¶Ëģʽ´æ´¢£¬ÆäÄÚ´æ²¼¾ÖÈçÏÂͼ£º


ÒÔС¶Ëģʽ´æ´¢£¬ÆäÄÚ´æ²¼¾ÖÈçÏÂͼ£º


±äÁ¿¡¡
iÕ¼¡¡
4¸ö×Ö½Ú£¬µ«Ö»ÓÐÒ»¸ö×Ö½ÚµÄֵΪ¡¡
1£¬ÁíÍâÈý¸ö×Ö½ÚµÄÖµ¶¼Îª¡¡
0¡£Èç¹ûÈ¡³öµÍ
µØÖ·ÉϵÄֵΪ¡¡
0£¬ºÁÎÞÒÉÎÊ£¬ÕâÊÇ´ó¶Ëģʽ£»Èç¹ûÈ¡³öµÍµØÖ·ÉϵÄֵΪ¡¡
1£¬ºÁÎÞÒÉÎÊ£¬ÕâÊÇ
С¶Ëģʽ¡£¼ÈÈ»Èç´Ë£¬ÎÒÃÇÍêÈ«¿ÉÒÔÀûÓá¡
unionÀàÐÍÊý¾ÝµÄÌص㣺ËùÓгÉÔ±µÄÆðʼµØÖ·Ò»Ö¡£
µ½ÏÖÔÚ£¬Ó¦¸ÃÖªµÀÔõôдÁË°É£¿²Î¿¼´ð°¸ÈçÏ£º¡¡


intcheckSystem£¨¡¡
£©¡¡


£û¡¡


unioncheck¡¡


£û¡¡


int¡¡
i£»¡¡


char¡¡
ch£»¡¡


£ýc£»¡¡


c¡£i¡¡
=1£»¡¡
return£¨c¡£ch¡¡
1£©£»¡¡
£ý


ÏÖÔÚÄã¿ÉÒÔÓÃÕâ¸öº¯ÊýÀ´²âÊÔÄ㵱ǰϵͳµÄ´æ´¢Ä£Ê½ÁË¡£µ±È»ÄãÒ²¿ÉÒÔ²»Óú¯Êý¶øÖ±
½ÓÈ¥²é¿´ÄÚ´æÀ´È·¶¨µ±Ç°ÏµÍ³µÄ´æ´¢Ä£Ê½¡£ÈçÏÂͼ£º


ͼÖС¡
0x01µÄÖµ´æÔڵ͵ØÖ·ÉÏ£¬ËµÃ÷µ±Ç°ÏµÍ³ÎªÐ¡¶Ëģʽ¡£
²»¹ýҪ˵Ã÷µÄÒ»µãÊÇ£¬Ä³Ð©ÏµÍ³¿ÉÄÜͬʱ֧³ÖÕâÁ½Öִ洢ģʽ£¬Äã¿ÉÒÔÓÃÓ²¼þÌøÏß»ò
ÔÚ±àÒëÆ÷µÄÑ¡ÏîÖÐÉèÖÃÆä´æ´¢Ä£Ê½¡£
Áô¸öÎÊÌ⣺

ÔÚ¡¡
x86ϵͳÏ£¬Êä³öµÄֵΪ¶àÉÙ£¿¡¡
#include¡¡
¡¡
intmain£¨£©¡¡
£û¡¡


inta£§5£§=£û1£»2£»3£»4£»5£ý£»¡¡
int*ptr1=£¨int*£©£¨&a£«1£©£»¡¡



int*ptr2=£¨int*£©£¨£¨int£©a£«1£©£»¡¡


printf£¨¡¨£¥x£»£¥x¡¨£»ptr1£§¡­1£§£»*ptr2£©£»¡¡


return0£»¡¡
£ý


1¡£16£¬enum¹Ø¼ü×Ö
ºÜ¶à³õѧÕ߶Ôö¾Ù£¨enum£©¸Ðµ½ÃԻ󣬻òÕßÈÏΪûʲôÓã¬Æäʵö¾Ù¡¡
£¨enum£©ÊǸöºÜÓÐÓõÄ
Êý¾ÝÀàÐÍ¡£

1¡£16¡£1£»Ã¶¾ÙÀàÐ͵ÄʹÓ÷½·¨
Ò»°ãµÄ¶¨Ò巽ʽÈçÏ£º¡¡


enumenum_type_name¡¡


£û¡¡
ENUM_CONST_1£»¡¡
ENUM_CONST_2£»¡¡
¡£¡£¡£¡¡
ENUM_CONST_n¡¡


£ýenum_variable_name£»

×¢Ò⣺enum_type_nameÊÇ×Ô¶¨ÒåµÄÒ»ÖÖÊý¾ÝÊý¾ÝÀàÐÍÃû£¬¶ø¡¡
enum_variable_nameΪ¡¡
enum_type_nameÀàÐ͵ÄÒ»¸ö±äÁ¿£¬Ò²¾ÍÊÇÎÒÃÇƽʱ³£ËµµÄö¾Ù±äÁ¿¡£Êµ¼ÊÉÏ¡¡
enum_type_name
ÀàÐÍÊǶÔÒ»¸ö±äÁ¿È¡Öµ·¶Î§µÄÏÞ¶¨£¬¶ø»¨À¨ºÅÄÚÊÇËüµÄÈ¡Öµ·¶Î§£¬¼´¡¡
enum_type_nameÀàÐÍ
µÄ±äÁ¿¡¡
enum_variable_nameÖ»ÄÜȡֵΪ»¨À¨ºÅÄÚµÄÈκÎÒ»¸öÖµ£¬Èç¹û¸³¸ø¸ÃÀàÐͱäÁ¿µÄÖµ
²»ÔÚÁбíÖУ¬Ôò»á±¨´í»òÕß¾¯¸æ¡£ENUM_CONST_1¡¢ENUM_CONST_2¡¢¡£¡£¡£¡¢¡¡
ENUM_CONST_n£¬ÕâЩ³ÉÔ±¶¼Êdz£Á¿£¬Ò²¾ÍÊÇÎÒÃÇƽʱËù˵µÄö¾Ù³£Á¿£¨³£Á¿Ò»°ãÓôóд£©¡£¡¡
enum±äÁ¿ÀàÐÍ»¹¿ÉÒÔ¸øÆäÖеij£Á¿·ûºÅ¸³Öµ£¬Èç¹û²»¸³ÖµÔò»á´Ó±»¸³³õÖµµÄÄǸö³£Á¿¿ªÊ¼
ÒÀ´Î¼Ó¡¡
1£¬Èç¹û¶¼Ã»Óи³Öµ£¬ËüÃǵÄÖµ´Ó¡¡
0¿ªÊ¼ÒÀ´ÎµÝÔö¡¡
1¡£Èç·Ö±ðÓÃÒ»¸ö³£Êý±íʾ²»Í¬ÑÕ
É«£º¡¡


enumColor¡¡


£û¡¡
GREEN¡¡
=¡¡
1£»¡¡
RED£»¡¡
BLUE£»¡¡
GREEN_RED¡¡
=¡¡
10£»¡¡
GREEN_BLUE¡¡


£ýColorVal£»

ÆäÖи÷³£Á¿Ãû´ú±íµÄÊýÖµ·Ö±ðΪ£º


GREEN¡¡
=¡¡
1¡¡


RED¡¡
=¡¡
2¡¡


BLUE¡¡
=¡¡
3¡¡


GREEN_RED¡¡
=¡¡
10¡¡


GREEN_BLUE¡¡
=¡¡
11

1¡£16¡£2£¬Ã¶¾ÙÓë#defineºêµÄÇø±ð
ÏÂÃæÔÙ¿´¿´Ã¶¾ÙÓë#defineºêµÄÇø±ð£º¡¡


1£©£¬#defineºê³£Á¿ÊÇÔÚÔ¤±àÒë½×¶Î½øÐмòµ¥Ìæ»»¡£Ã¶¾Ù³£Á¿ÔòÊÇÔÚ±àÒëµÄʱºòÈ·¶¨ÆäÖµ¡£¡¡
2£©£¬Ò»°ãÔÚ±àÒëÆ÷À¿ÉÒÔµ÷ÊÔö¾Ù³£Á¿£¬µ«ÊDz»Äܵ÷ÊԺ곣Á¿¡£¡¡
3£©£¬Ã¶¾Ù¿ÉÒÔÒ»´Î¶¨Òå´óÁ¿Ïà¹ØµÄ³£Á¿£¬¶ø¡¡
#defineºêÒ»´ÎÖ»Äܶ¨ÒåÒ»¸ö¡£
ÁôÁ½¸öÎÊÌ⣺¡¡


A£©£¬Ã¶¾ÙÄÜ×öµ½Ê£¬¡¡
#defineºêÄܲ»Äܶ¼×öµ½£¿Èç¹ûÄÜ£¬ÄÇΪʲô»¹ÐèҪö¾Ù£¿¡¡
B£©£¬sizeof£¨ColorVal£©µÄֵΪ¶àÉÙ£¿ÎªÊ²Ã´£¿
1¡£17£¬Î°´óµÄ·ìÈÒʦtypedef¹Ø¼ü×Ö
1¡£17¡£1£¬¹ØÓÚÂí¼×µÄЦ»°
ÓÐÕâÑùÒ»¸öЦ»°£ºÒ»¸öÁÔÈËÔÚºÓ±ß×¥²¶Ò»ÌõÉߣ¬ÉßÌÓ½øÁËË®Àï¡£¹ýÒ»»á£¬Ò»¸öÎÚ¹êÅÀ
µ½°¶±ß¡£ÁÔÈËÒ»°ÑץסÕâ¸öÎڹ꣬´óÉùµÄ˵µÀ£ºÐ¡Ñù£¬±ðÄãΪÄã´©Á˸öÂí¼×ÎҾͲ»ÈÏʶÄã
ÁË£¡¡¡


typedef¹Ø¼ü×ÖÊǸöΰ´óµÄ·ìÈÒʦ£¬Éó¤×öÂí¼×£¬Èκζ«Î÷´©ÉÏÕâ¸öÂí¼×¾ÍÁ¢Âí±äÑù¡£
Ëü¿ÉÒÔ°ÑÀDZä³ÉһͷÑò£¬Ò²ÄÜ°ÑÑò±ä³ÉһͷÀÇ¡£ÉõÖÁ»¹¿ÉÒ԰ѳ¤×ųá°òµÄÄñÈ˱ä³ÉÌìʹ£¬
ͬÑùÒ²ÄÜ°ÑÃÀÀöµÄÌìʹ±ä³ÉÄñÈË¡£ËùÒÔ£¬ÄãǧÍò²»ÒªµÃ×ïËü£¬Ò»¶¨ÒªÕÆÎÕËüµÄÆ¢Æø£¬²»È»
ÄÄÌìÎÒ°ÑÄãµ±ÄñÈË£¬Äã¿É±ð¹ÖÎÒ¡£^_^¡£

1¡£17¡£2£¬ÀúÊ·µÄÎó»áÒ²ÐíÓ¦¸ÃÊÇ¡¡
typerename
ºÜ¶àÈËÈÏΪ¡¡
typedefÊǶ¨ÒåеÄÊý¾ÝÀàÐÍ£¬Õâ¿ÉÄÜÓëÕâ¸ö¹Ø¼ü×ÖÓйء£±¾À´Â¡¡
typeÊÇ
Êý¾ÝÀàÐ͵ÄÒâ˼£»def£¨ine£©ÊǶ¨ÒåµÄÒâ˼£¬ºÏÆðÀ´¾ÍÊǶ¨ÒåÊý¾ÝÀàÐÍÀ²¡£²»¹ýºÜÒź¶£¬ÕâÖÖ
Àí½âÊDz»ÕýÈ·µÄ¡£Ò²ÐíÕâ¸ö¹Ø¼ü×ָñ»Ì滻Ϊ¡°typerename¡±»òÊDZðµÄ´Ê¡£¡¡


typedefµÄÕæÕýÒâ˼ÊǸøÒ»¸öÒѾ­´æÔÚµÄÊý¾ÝÀàÐÍ£¨×¢Ò⣺ÊÇÀàÐͲ»ÊDZäÁ¿£©È¡Ò»¸ö±ð
Ãû£¬¶ø·Ç¶¨ÒåÒ»¸öеÄÊý¾ÝÀàÐÍ¡£±ÈÈ磺»ªÃÀ¾øÂ×µÄÉÖÒ©£¬¾ÍÓиö±ðÃû¡¡
¡­¡°½«À롱¡£Öйú¹Å
´úÄÐÅ®½»Íù£»ÍùÍùÒÔÉÖÒ©ÏàÔù£»±í´ïϧ±ðÖ®Ç飻ËÍÉÖÒ©¾ÍÒâζ׿´½«·ÖÀë¡£ËùÒÔÎÄÈËÄ«¿Í¾Í¸øÉÖ
Ò©È¡Á˸öÒâζÉµÄ±ðÃû¡­¡°½«À롱¡£Õâ¸öеÄÃû×־ͱí´ïÁËÄÇÖÖÒÀÒÀ²»ÉáµÄϧ±ðÖ®Çé¡­¡¡



ÕâÑùеÄÃû×ÖÓëÔ­À´µÄÃû×ÖÏà±È£¬¾Í¸üÄܱí´ï³öÏëÒª±í´ïµÄÒâ˼¡£
ÔÚʵ¼ÊÏîÄ¿ÖУ¬ÎªÁË·½±ã£¬¿ÉÄܺܶàÊý¾ÝÀàÐÍ£¨ÓÈÆäÊǽṹÌåÖ®ÀàµÄ×Ô¶¨ÒåÊý¾ÝÀàÐÍ£©

ÐèÒªÎÒÃÇÖØÐÂÈ¡Ò»¸öÊÊÓÃʵ¼
СÌáʾ£º°´ »Ø³µ [Enter] ¼ü ·µ»ØÊéÄ¿£¬°´ ¡û ¼ü ·µ»ØÉÏÒ»Ò³£¬ °´ ¡ú ¼ü ½øÈëÏÂÒ»Ò³¡£ ÔÞһϠÌí¼ÓÊéÇ©¼ÓÈëÊé¼Ü