CÖ¸ÕëÉùÃ÷½â¶ÁÖ®×óÓÒ·¨Ôò
C
ÓïÑÔËùÓи´ÔÓµÄÖ¸ÕëÉùÃ÷£¬¶¼ÊÇÓɸ÷ÖÖÉùÃ÷ǶÌ×¹¹³ÉµÄ¡£ÈçºÎ½â¶Á¸´ÔÓÖ¸ÕëÉùÃ÷ÄØ£¿ÓÒ×ó·¨ÔòÊÇÒ»¸ö¼ÈÖøÃûÓÖ³£Óõķ½·¨¡£²»¹ý£¬ÓÒ×ó·¨ÔòÆäʵ²¢²»ÊÇC
±ê×¼ÀïÃæµÄÄÚÈÝ£¬ËüÊÇ´ÓC
±ê×¼µÄÉùÃ÷¹æ¶¨ÖйéÄɳöÀ´µÄ·½·¨¡£C
±ê×¼µÄÉùÃ÷¹æÔò£¬ÊÇÓÃÀ´½â¾öÈçºÎ´´½¨ÉùÃ÷µÄ£¬¶øÓÒ×ó·¨ÔòÊÇÓÃÀ´½â¾öÈçºÎ±çʶһ¸öÉùÃ÷µÄ£¬Á½Õß¿ÉÒÔ˵ÊÇÏà·´µÄ¡£ÓÒ×ó·¨ÔòµÄÓ¢ÎÄÔÎÄÊÇÕâÑù˵µÄ£º
The
right-left rule: Start reading
the declaration from the
innermost parentheses, go
right, and then go
left. When you encounter parentheses,
the direction should be
reversed. Once everything in
the parentheses has been
parsed, jump out of it.
Continue till the whole
declaration has been parsed.
Õâ¶ÎÓ¢ÎĵķÒëÈçÏ£º
ÓÒ×ó·¨Ôò£ºÊ×ÏÈ´Ó×îÀïÃæµÄÔ²À¨ºÅ¿´Æð£¬È»ºóÍùÓÒ¿´£¬ÔÙÍù×ó¿´¡£Ã¿µ±Óöµ½Ô²À¨ºÅʱ£¬¾ÍÓ¦¸ÃµôתÔĶÁ·½Ïò¡£Ò»µ©½âÎöÍêÔ²À¨ºÅÀïÃæËùÓеĶ«Î÷£¬¾ÍÌø³öÔ²À¨ºÅ¡£Öظ´Õâ¸ö¹ý³ÌÖ±µ½Õû¸öÉùÃ÷½âÎöÍê±Ï¡£
±ÊÕßÒª¶ÔÕâ¸ö·¨Ôò½øÐÐÒ»¸öССµÄÐÞÕý£¬Ó¦¸ÃÊÇ´Ó䶨ÒåµÄ±êʶ·û¿ªÊ¼ÔĶÁ£¬¶ø²»ÊÇ´ÓÀ¨ºÅ¶ÁÆð£¬Ö®ËùÒÔÊÇ䶨ÒåµÄ±êʶ·û£¬ÊÇÒòΪһ¸öÉùÃ÷ÀïÃæ¿ÉÄÜÓжà¸ö±êʶ·û£¬µ«Î´¶¨ÒåµÄ±êʶ·ûÖ»»áÓÐÒ»¸ö¡£
ÏÖÔÚͨ¹ýһЩÀý×ÓÀ´ÌÖÂÛÓÒ×ó·¨ÔòµÄÓ¦Óã¬ÏÈ´Ó×î¼òµ¥µÄ¿ªÊ¼£¬Öð²½¼ÓÉ
int (*func)(int *p);
Ê×ÏÈÕÒµ½ÄǸö䶨ÒåµÄ±êʶ·û£¬¾ÍÊÇfunc
£¬ËüµÄÍâÃæÓÐÒ»¶ÔÔ²À¨ºÅ£¬¶øÇÒ×ó±ßÊÇÒ»¸ö*
ºÅ£¬Õâ˵Ã÷func
ÊÇÒ»¸öÖ¸Õ룬ȻºóÌø³öÕâ¸öÔ²À¨ºÅ£¬ÏÈ¿´Ó
Ïà¹ØÎĵµ£º
Ò»¡¢¼ò½é
µ÷ÊÔÆ÷(±ÈÈçÏóGDB)ÄÜÈÃÄã¹Û²ìÁíÒ»¸ö³ÌÐòÔÚÖ´ÐÐʱµÄÄÚ²¿»î¶¯£¬»ò³ÌÐò³ö´íʱ·¢ÉúÁËʲô¡£GDBÖ÷ÒªÄÜΪÄã×öËļþÊÂ(°üÀ¨ÎªÁËÍê³ÉÕâЩʶø¸½¼ÓµÄ¹¦ÄÜ)£¬°ïÖúÄãÕÒ³ö³ÌÐòÖеĴíÎó¡£
* ÔËÐÐÄãµÄ³ÌÐò£¬ÉèÖÃËùÓеÄÄÜÓ°Ïì³ÌÐòÔËÐеĶ«Î÷¡ ......
ÍøÓѹ۵ã:
(Ò»):
ÎÒÈÏΪºÜ¶àÈËûÓÐÀí½âlinus»òÕßmyanµÄÒâ˼£¬ÎÒ¾Ù¸öʵÀý¡£
ÎÒÃÇÏÖÔÚÒªÉè¼ÆÒ»Ì×ÍøÂ磿ͻ§¶ËÈí¼þ£¬ÎÒÃÇÒªÏÈ°ÑÐÒ鶨ºÃ£¬°Ñ½çÃæºÍºǫ́½»»¥Éè¼ÆÏëºÃ£¬°ÑÈÝ´íºÍ»Ö¸´ÏëºÃ£¬ÎÒÈÏΪÕâЩÊÇ×îÖØÒªµÄ£¬ÖÁÓÚ±àÂ룬ÓÃCÒ²¿ÉÒÔ±à³öÀ´£¬ÓÃC£«£«Ò²¿ÉÒÔ±à³öÀ´£¬ÉõÖÁÓÃJAVAÒ²Äܱà³öÀ´£¬¹Ø¼üÊÇÕû¸öÈí¼þµÄ¼Ü¹¹ÒªÇåÎú£¬Õ ......
[CÓïÑÔ]fopen()º¯ÊýµÄ²ÎÊý˵Ã÷
2007Äê06ÔÂ05ÈÕ ÐÇÆÚ¶þ 23:55
¸ñʽ£ºÎļþÖ¸ÕëÃû=fopen(ÎļþÃû£¬Ê¹ÓÃÎļþ·½Ê½)
²ÎÊý£º
ÎļþÃû ÒâÒå
"C:/temp/temp.txt" Îļþ C:\temp\temp.txt
ÎļþʹÓ÷½Ê½ ¡¡ Òâ Òå
“rt”¡¡¡¡¡¡¡¡¡¡Ö»¶Á´ò¿ªÒ»¸öÎı¾Îļþ£¬Ö»ÔÊÐí¶ÁÊý¾Ý
“wt”¡¡¡¡¡¡¡¡ ֻд ......
PS:
½ñÌìÈ¥¸£ê¿²Î¼ÓËûÃǹ«Ë¾µÄ±ÊÊÔÁË£¬¿¼µÄ²»ÊǺÜˬ¡£¡£¡£¡£¡£Ò»Ð©ºÜ¼òµ¥µÄ¸ÅÄîÌ⣬²»ÖªµÀÔõô×÷´ð£¬¿´À´Òª¶à¶à¹®¹ÌÏÂÀíÂÛ֪ʶÀ²£¡£¡£¡£¡£¡£¡
ÒÔÏÂת:
ÎÒ´Óʼ¼Êõ¹¤×÷£¬
Õ⼸ÄêµÄÃæÊÔÓë±»ÃæÊÔ×ܽá
ÏÈ˵ÎÒÈ¥±»ÃæÊԵľÑé°É¡£
»Ø´ðÇå³þÁË2¸öÎÊÌ⣬¾ÍÄÜ˳Àû¹ý¹ØÁË¡£
1¡£ÎªÊ²Ã´ÒªÀ뿪ÉÏÒ ......
ºÜÆæ¹Ö£¬ÒÔÇ°Ò»Ö±ÒÔΪC++ÊǼæÈÝCµÄ£¬µ«ÊÇ£¬½ñÌìÓÃlex&yaccÉú³ÉµÄC´úÂë¿ÉÓÃͨ¹ýGCCµÄ±àÒ룬
µ«ÊÇÔõô¶¼Í¨²»¹ýG++µÄ±àÒ룬¶øÆä´íÎóºÜ¶à£¬ÓпÉÄÜÊÇlex&yaccÉú³ÉµÄC´úÂëÌ«ÀÏÁË£¬£¬£¬
ÎÒÊÇÕâÑù½â¾öµÄ
°Ñlex&yaccÉú³ÉµÄ´úÂë Óà GCC -c ±àÒë³É lex.o µÄÄ¿±êÎļþ¡£È»ºó g++ main.cpp lex.o ,¾ÍOKÁË
¼ÇµÃ£º ÔÚ main. ......