C/C++ÖÐÖ¸ÕëºÍÒýÓÃÖ®Ïà¹ØÎÊÌâÑо¿
Ò»¡¢»ù±¾ÖªÊ¶
Ö¸ÕëºÍÒýÓõÄÉùÃ÷·½Ê½£º
ÉùÃ÷Ö¸Õ룺char* pc;
ÉùÃ÷ÒýÓãºchar& rc = 0;
ËüÃǵÄÇø±ð£º
¢Ù´ÓÏÖÏóÉÏ¿´£¬Ö¸ÕëÔÚÔËÐÐʱ¿ÉÒԸıäÆäËùÖ¸ÏòµÄÖµ£¬¶øÒýÓÃÒ»µ©ºÍij¸ö¶ÔÏó°ó¶¨ºó¾Í²»Ôٸı䡣Õâ¾ä»°¿ÉÒÔÀí½âΪ£ºÖ¸Õë¿ÉÒÔ±»ÖØи³ÖµÒÔÖ¸ÏòÁíÒ»¸ö²»Í¬µÄ¶ÔÏó¡£µ«ÊÇÒýÓÃÔò×ÜÊÇÖ¸ÏòÔÚ³õʼ»¯Ê±±»Ö¸¶¨µÄ¶ÔÏó£¬ÒÔºó²»Äܸı䣬µ«ÊÇÖ¸¶¨µÄ¶ÔÏóÆäÄÚÈÝ¿ÉÒԸı䡣
¢Ú´ÓÄÚ´æ·ÖÅäÉÏ¿´£¬³ÌÐòΪָÕë±äÁ¿·ÖÅäÄÚ´æÇøÓò£¬¶ø²»ÎªÒýÓ÷ÖÅäÄÚ´æÇøÓò£¬ÒòΪÒýÓÃÉùÃ÷ʱ±ØÐë³õʼ»¯£¬´Ó¶øÖ¸ÏòÒ»¸öÒѾ´æÔڵĶÔÏó¡£ÒýÓò»ÄÜÖ¸Ïò¿ÕÖµ¡£
¢Û´Ó±àÒëÉÏ¿´£¬³ÌÐòÔÚ±àÒëʱ·Ö±ð½«Ö¸ÕëºÍÒýÓÃÌí¼Óµ½·ûºÅ±íÉÏ£¬·ûºÅ±íÉϼǼµÄÊDZäÁ¿Ãû¼°±äÁ¿Ëù¶ÔÓ¦µØÖ·¡£Ö¸Õë±äÁ¿ÔÚ·ûºÅ±íÉ϶ÔÓ¦µÄµØֵַΪָÕë±äÁ¿µÄµØÖ·Öµ£¬¶øÒýÓÃÔÚ·ûºÅ±íÉ϶ÔÓ¦µÄµØֵַΪÒýÓöÔÏóµÄµØÖ·Öµ¡£·ûºÅ±íÉú³Éºó¾Í²»»áÔٸģ¬Òò´ËÖ¸Õë¿ÉÒԸıäÖ¸ÏòµÄ¶ÔÏó£¨Ö¸Õë±äÁ¿ÖеÄÖµ¿ÉÒԸģ©£¬¶øÒýÓöÔÏó²»Äܸġ£ÕâÊÇʹÓÃÖ¸Õë²»°²È«¶øʹÓÃÒýÓð²È«µÄÖ÷ÒªÔÒò¡£´ÓijÖÖÒâÒåÉÏÀ´ËµÒýÓÿÉÒÔ±»ÈÏΪÊDz»ÄܸıäµÄÖ¸Õë¡£
¢Ü²»´æÔÚÖ¸Ïò¿ÕÖµµÄÒýÓÃÕâ¸öÊÂʵÒâζ×ÅʹÓÃÒýÓõĴúÂëЧÂʱÈʹÓÃÖ¸ÕëµÄÒª¸ß¡£ÒòΪÔÚʹÓÃÒýÓÃ֮ǰ²»ÐèÒª²âÊÔËüµÄºÏ·¨ÐÔ¡£Ïà·´£¬Ö¸ÕëÔòÓ¦¸Ã×ÜÊDZ»²âÊÔ£¬·ÀÖ¹ÆäΪ¿Õ¡£
¢ÝÀíÂÛÉÏ£¬¶ÔÓÚÖ¸ÕëµÄ¼¶ÊýûÓÐÏÞÖÆ£¬µ«ÊÇÒýÓÃÖ»ÄÜÊÇÒ»¼¶¡£ÈçÏ£º
int** p1; // ºÏ·¨¡£Ö¸ÏòÖ¸ÕëµÄÖ¸Õë
int*& p2; // ºÏ·¨¡£Ö¸ÏòÖ¸ÕëµÄÒýÓÃ
int&* p3; // ·Ç·¨¡£Ö¸ÏòÒýÓõÄÖ¸ÕëÊÇ·Ç·¨µÄ
int&& p4; // ·Ç·¨¡£Ö¸ÏòÒýÓõÄÒýÓÃÊÇ·Ç·¨µÄ
×¢ÒâÉÏÊö¶Á·¨ÊÇ´Ó×óµ½ÓÒ¡£
³ÌÐò1£º
#include "stdio.h"
int main(void)
{
// ÉùÃ÷Ò»¸öcharÐÍÖ¸Õëpc£¬ÇÒÈÃËüÖ¸Ïò¿ÕÖµ
char* pc = 0;
char a = 'a';
// ÉùÃ÷Ò»¸öÒýÓÃrc£¬ÇÒÈÃËüÒýÓñäÁ¿a
char& rc = a;
printf("%d, %c\n", pc, rc);
char *pc2;
// ÉùÃ÷Ò»¸öÖ¸Õ룬µ«¿ÉÒÔ²»³õʼ»¯
pc2 = pc;
// char& rc2;
// ÉÏÃæÓï¾ä±àÒëʱ£¬»á²úÉúÈçÏ´íÎó£º
// error C2530: 'rc2' : references must be initialized
// ¼´£¬Ó¦ÓñØÐë³õʼ
Ïà¹ØÎĵµ£º
<<ISO/ANSI C±ê×¼ÒëÎÄÓë×¢½â C/C++Ô¤´¦Àí²¿·Ö>>
ÄÚÈݼò½é£º±¾ÎĵµÍêÕû·ÒëÁËC±ê×¼(99°æ)ÖÐÔ¤´¦ÀíºÍÏà¹ØÕ½ڵÄÄÚÈÝ£¬²¢ÔÚÐí¶à±ØÒªÖ®´¦¸½¼ÓÁË×¢½âºÍ³ÌÐòʾÀý£¬ÒÔ°ïÖú¶ÁÕßÀí½â±ê×¼ÔÎÄ£¬Í¬Ê±ÖÆ×÷ÁËÏêϸµÄÖÐÓ¢ÎÄË÷Òý±¸²é¡£
ÒëÕߣººúÑå
³ö´¦£ºhttp://blog.csdn.net/huyansoft
Èç¹ûתÔØ£¬Çë±£ÁôÒëÕߺͳö´¦ÐÅÏ¢£¬Ð ......
ת×Ô£ºhttp://dev.csdn.net/article/29/29329.shtm
¹ØÓÚÂß¼ÒÆλ¡¢ËãÊõÒÆλ¿É²Î¼û ѸÀ×Éî´ó±ÊÊÔÌⲿ·Ö¡£µÄÒ»µÀÌâ¡£
ÒÔÇ°¿´µ½C++±ê×¼ÉÏ˵£¬ÒÆλÔËËã·û£¨<<¡¢>>£©³ö½çʱµÄÐÐΪ²¢²»È·¶¨£º
The behavior is undefined if the right operand is negative, or greater than or equal to the length in bit ......
ÏÖÔڵĹ«Ë¾ÕÐƸ,¶¼Òª±ÊÊÔÃæÊÔ.Èç¹ûÄã²»ÊÇÄÇÖÖ±à³Ì¹¦µ×·Ç³£ÉîºñµÄÈË,ÓÖ²»ºÃºÃ×¼±¸Ò»·¬,ÔÚ±ÊÊÔÃæÊÔÖÐÍùÍù»á´¦ÓÚ±»¶¯¾ÖÃæ.ËäÈ»ÓÐЩ±ÊÊÔÌâÊǹÊÒâΪÄÑÎÒÃÇ£¬Óеã×êÅ£½Ç¼â.µ«ÊǺܶà±ÊÊÔÌâÃæÊÔÌâȷʵÄܹ»ºÜºÃµØ¿´³öÎÒÃǵĻù´¡. ÔÚÕâÀï,ÎÒ¾ÍÂÔÈ¥ÄÇЩ×êÅ£½Ç¼âµÄÌâ.´ÓcsdnÂÛ̳ÎÒ½ü°ëÄêµÄÊÕ¼¯ÖÐÑ¡³ö10µÀÓдú±íÐÔµÄÌâÄ¿,ÄѶȻù±¾ÉÏÊÇÖ ......
VS2005Öмì²âºÍ¸üÕý C/C++ ´úÂëȱÏÝ
2006-11-26 15:55
VS2005ÖÐÌṩµÄ¼ì²â·½·¨:
1 IDE£¨¼¯³É¿ª·¢»·¾³£©¼¯³É
2 #pragma Ö§³Ö
3 Åú×¢Ö§³Ö
4 ×÷ΪǩÈë²ßÂÔµÄÒ»²¿·ÖÔËÐзÖÎö¹¤¾ß
5 Team System Óë Team Build µÄ¼¯³É
6 ÃüÁîÐÐÖ§³Ö
Ò» ´úÂë·ÖÎö¹¤¾ßÓÃÓÚ¼ì²â³£¼ûµÄ±àÂë´íÎó£¬ÀýÈ绺³åÇøÒç³ö¡¢ÄÚ´æδ³õʼ»¯¡¢¿ÕÖ¸Õë ......