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Ö÷ÒªÄÜΪÄã×öËļþÊÂ(°üÀ¨ÎªÁËÍê³ÉÕâЩʶø¸½¼ÓµÄ¹¦ÄÜ)£¬°ïÖúÄãÕÒ³ö³ÌÐòÖеĴíÎó¡£
* ÔËÐÐÄãµÄ³ÌÐò£¬ÉèÖÃËùÓеÄÄÜÓ°Ïì³ÌÐòÔËÐеĶ«Î÷¡ ......
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã ......
[CÓïÑÔ]fopen()º¯ÊýµÄ²ÎÊý˵Ã÷
2007Äê06ÔÂ05ÈÕ ÐÇÆÚ¶þ 23:55
¸ñʽ£ºÎļþÖ¸ÕëÃû=fopen(ÎļþÃû£¬Ê¹ÓÃÎļþ·½Ê½)
²ÎÊý£º
ÎļþÃû ÒâÒå
"C:/temp/temp.txt" Îļþ C:\temp\temp.txt
ÎļþʹÓ÷½Ê½ ¡¡ Òâ Òå
“rt”¡¡¡¡¡¡¡¡¡¡Ö»¶Á´ò¿ªÒ»¸öÎı¾Îļþ£¬Ö»ÔÊÐí¶ÁÊý¾Ý
“wt”¡¡¡¡¡¡¡¡ ֻд ......
1.ÒýÑÔ ¡¡¡¡
±¾ÎĵÄд×÷Ä¿µÄ²¢²»ÔÚÓÚÌṩC/C++³ÌÐòÔ±ÇóÖ°ÃæÊÔÖ¸µ¼£¬¶øÖ¼ÔÚ´Ó¼¼ÊõÉÏ·ÖÎöÃæÊÔÌâµÄÄÚº¡£ÎÄÖеĴó¶àÊýÃæÊÔÌâÀ´×Ô¸÷´óÂÛ̳£¬²¿·ÖÊÔÌâ½â´ðÒ²²Î¿¼ÁËÍøÓѵÄÒâ¼û¡£
Ðí¶àÃæÊÔÌâ¿´ËƼòµ¥£¬È´ÐèÒªÉîºñµÄ»ù±¾¹¦²ÅÄܸø³öÍêÃÀµÄ½â´ð¡£ÆóÒµÒªÇóÃæÊÔ ......
ºÜÆæ¹Ö£¬ÒÔÇ°Ò»Ö±ÒÔΪC++ÊǼæÈÝCµÄ£¬µ«ÊÇ£¬½ñÌìÓÃlex&yaccÉú³ÉµÄC´úÂë¿ÉÓÃͨ¹ýGCCµÄ±àÒ룬
µ«ÊÇÔõô¶¼Í¨²»¹ýG++µÄ±àÒ룬¶øÆä´íÎóºÜ¶à£¬ÓпÉÄÜÊÇlex&yaccÉú³ÉµÄC´úÂëÌ«ÀÏÁË£¬£¬£¬
ÎÒÊÇÕâÑù½â¾öµÄ
°Ñlex&yaccÉú³ÉµÄ´úÂë Óà GCC -c ±àÒë³É lex.o µÄÄ¿±êÎļþ¡£È»ºó g++ main.cpp lex.o ,¾ÍOKÁË
¼ÇµÃ£º ÔÚ main. ......