C/C++ Ò×´í
char c[] = "hello world" ·ÖÅä¾Ö²¿Êý×é
char* c = "hello world" ·ÖÅäÈ«¾ÖÊý×é È«¾ÖÇøÓòµÄÖµÊDz»ÄܽøÐÐÐ޸ĵÄ
1 ³£Á¿Ö¸Õ룡Èç int b, c; int * const a = &b;
±íʾaÊÇÒ»¸ö³£Á¿Ö¸ÕëËüÖ¸Ïò±äÁ¿bµÄÄÚ´æ¡£µ«ÊÇÒòΪÊdz£Á¿Ö¸ÕëËùÒÔ²»ÄÜÔÙÓÃaÖ¸ÏòÆäËû±äÁ¿£¬Èç a = &c; ´íÎ󣡿ÉÒÔÐÞ¸ÄÖ¸ÏòÄÚ´æµÄÖµ£¬Èç:*a = 20; BTW ³£Á¿Ö¸ÕëÉùÃ÷µÄʱºò±ØÐëÏòÎÒÄÇÑù¸³³õÖµ¡£
2 Ö¸Ïò³£Á¿µÄÖ¸Õ룡Èç int b, c; int const *a; a = &b; a = &c;
¶¼¿ÉÒÔ£¬Î¨¶ÀËüÖ¸ÏòµÄÄÚ´æ²»Äܱ»Ð޸ġ£È磺*a=20;ÕâÊÇÎ¥·¨µÄ£¡´íÎó£¡
Õâ¾ÍÊÇÖ÷ÒªÇø±ð£¡
BTW »¹ÓÐÒ»¸ö¼ÇסËûÃDz»Í¬ÐÎʽµÄ¼¼ÇÉ£¡¿´const¹Ø¼ü×Ö£¬ËûºóÃæµÄ²»¿ÉÐ޸ģ¬Èçint * const a = &b; ºóÃæÊÇa,Ôò˵Ã÷a²»ÄÜÐ޸ģ¡
int const * a = &b;ºóÃæÊÇ*aÔò˵Ã÷*a²»¿É±»Ð޸ģ¡
ÔںöàÊéÉÏ»òMSDNÊǾ³£Óà const int a=5;
int b=6;
const int *p=&b;
Æäʵ const int* ºÍint const* Ò»Ñù£¬¾ÍÊdz£Ö¸Õë Ò²¾ÍÊÇËüËùÖ¸ÏòµÄÊý¾Ý£¨ÔÚÕâÊÇint£©Êdz£Á¿£¬Ëü×Ô¼ºµÄÊý¾ÝÀàÐÍÊÇconst int*
»¹ÓÐconst int *p=&b;ÊÇ¿ÉÒ﵀ ËäÈ»b²»Êdz£Á¿¡£
µ«ÊÇ const int a=6;
int *p=&a;
»á±¨´í£¬ÒòΪËüÏû³ýÁËaµÄconstÊôÐÔ
**********************************************
*******ÎÒÃÇ¿ÉÒÔ×ܽáÒ»ÏÂ********
1. ¶ÔÓÚ³£Á¿£¨·ûºÅ³£Á¿£©ºÍ³£Ö¸Õë¡¢³£ÒýÓó£¶ÔÏóÉùÃ÷¶¼ÊÇÒ»ÑùµÄ
¶¨Òå¸ñʽ£º const Êý¾ÝÀàÐÍ ³£Á¿Ãû=³£Á¿Öµ£»
»ò Êý¾ÝÀàÐÍ const ³£Á¿Ãû=³£Á¿Öµ£»
ÀýÈ磺const int a=7; »ò int const a=7;£¨·ûºÅ³£Á¿£©
int b=5;
const int *p=&b; »ò int const *p=&b;(³£Ö¸Õ룩
const int &m=b;£¨³£ÒýÓã©
const Point pt; »ò Point const pt; //³£¶ÔÏó²»ÄܸüÐÂ
³£Ö¸ÕëºÍ³£ÒýÓÃÔÚ¹¦ÄÜÉÏÓÐËùÏÞÖÆ£¬¾ÍÊDz»ÄÜͨ¹ýËûÃǸü¸ÄÆäÖ¸ÏòµÄ±äÁ¿µÄÊý¾Ý£¨Öµ£©
2. Ö¸Õë³£Á¿
¶¨Òå¸ñʽ£º Êý¾ÝÀàÐÍ *const Ö¸Õë³£Á¿=³£Á¿Öµ£»
Èçchar ch,*const pch=&ch;(ÎÒÊÇÒ»²½Íê³ÉµÄ£¬ÄãÒ²¿ÉÒÔ·Ö¿ª£©
Ò²¾ÍÊÇ˵Õâ¸öÖ¸Õë±¾ÉíÊǸö³£Á¿£¬²»¿É¸Ä±ä£¬¼´ËüËùÖ¸ÏòµÄµØÖ·Êǹ̶¨µÄ¡£µ«£¬chÊÇ¿ÉÒԸıäµÄ¡£
Ïà¹ØÎĵµ£º
C++ÀïÓõ½µÄÊý¾ÝÀàÐÍÓкܶ࣬±à³Ì¹ý³ÌÖкÜÈÝÒ×»ìÓã¬ÏÂÃæ×ۺϿ´µ½µÄ×ÊÁÏ£¨ÓÉÖÔ¸ÐлÎÞ˽¹²ÏíµÄÇ°±²ÃÇ£©¶Ô´Ë½øÐмòµ¥µÄ½âÎö
Ò»¡¢1.³£¼û×Ö·ûµÄÒâÒ壺
L:´ú±íLONG
W:´ú±íWIDE£¬Ò²¾ÍÊÇOLE,´ú±í¿í×Ö½Ú×Ö·û
P:´ú±íPOINTER
A:´ú±íANSIC,Ò²¾ÍÊÇMBCS¶à×Ö½Ú×Ö·û
&nbs ......
C/C++·µ»ØÄÚ²¿¾²Ì¬³ÉÔ±µÄÏÝÚå
³Âð©
±³¾°
ÔÚÎÒÃÇÓÃ
C/C++¿ª·¢µÄ¹ý³ÌÖУ¬×ÜÊÇÓÐÒ»¸öÎÊÌâ»á¸øÎÒÃÇ´øÀ´¿àÄÕ¡£Õâ¸öÎÊÌâ¾ÍÊǺ¯ÊýÄںͺ¯ÊýÍâ´úÂëÐèҪͨ¹ýÒ»¿éÄÚ´æÀ´½»»¥£¨±ÈÈ磬º¯Êý·µ»Ø×Ö·û´®£©£¬Õâ¸öÎÊÌâÀ§
Èźͺܶ࿪·¢ÈËÔ±¡£Èç¹ûÄãµÄÄÚ´æÊÇÔÚº¯ÊýÄÚÕ»ÉÏ·ÖÅäµÄ£¬ÄÇôÕâ¸öÄÚ´æ»áËæן¯ÊýµÄ·µ»Ø¶ø±»µ¯Õ»ÊÍ·Å£¬ËùÒÔ£¬Äã ......
ÔõÑù¼ÓÔØÆäËûµÄÓ¦ÓóÌÐò?
Èý¸öSDKº¯Êý winexec,
shellexecute,createprocess¿ÉÒÔʹÓá£WinExec×î¼òµ¥£¬Á½¸ö²ÎÊý£¬Ç°Ò»¸öÖ¸¶¨Â·¾¶£¬ºóÒ»¸öÖ¸¶¨ÏÔʾ·½Ê½.ºóÒ»¸ö²ÎÊýÖµµÃ
˵һÏ£¬±ÈÈçÄàÓÃ
SW_SHOWMAXMIZED·½Ê½È¥¼ÓÔØÒ»¸öÎÞ×î´ó»¯°´Å¥µÄ³ÌÐò£¬¾ÍÊÇNeterm,calcµÈµÈ£¬¾Í²»»á³öÏÖÕý³£µÄ´°Ì壬µ«ÊÇÒѾ±»¼Óµ½ÈÎÎñÁбíÀï
ÁË¡ ......
C++ÖеÄÊý¾ÝÀàÐÍת»»·½·¨
ÕªÒª£º±¾ÎÄ×ܽáÁËC/C++ÖеĶàÖÖÊý¾ÝÀàÐÍת»»·½·¨£¬²¢±È½ÏÁ˸÷×ÔµÄÓÅÁÓ¡£¸ø³öÁËÍƼöµÄʹÓý¨Òé¡£
´Óintµ½char*£¬»òÕß·´¹ýÀ´´Óchar*µ½int£¬ÔÚC/C++Öе½µ×ÓжàÉÙÖÖת»»·½·¨ÄØ£¿·ûºÏ±ê×¼µÄ´ó¸ÅÓÐËÄÖÖ¡£¼´CÊý¾Ýת»»º¯Êý×å¡¢sprintf/snprintf/sscanfº¯Êý×å¡¢×Ö·û´®Á÷std::stringstre ......
À´ÁËcsdnºÜ¾ÃÁË£¬¶¼Ã»Ð´¹ýÎÄÕ£¬Óеã¹ýÒⲻȥ£¬ÓÚÊDZÆ×Å×Ô¼ºÕâ¸öÀÁÈËдÁËÒ»ÏÂһЩ±£ÁôÔÚ¸öÈ˱ʼDZ¾ÉϵÄСµãµÎ£¬Ï£Íû²»»áÎóµ¼´ó¼Ò¡£¡£¡£¡£¡£Ò»ÏÂÖ»ÊDZʼÇÖеÄһС²¿·Ö£¬ÒÔºóÓпÕÔÚ¼ÌÐø·ÅÉÏÀ´¡£¡£¡£¡£¡£¡£
1 Ð麯ÊýÊÇΪÁ˼̳нӿںÍĬÈÏÐÐΪ¡£´¿Ð麯ÊýÖ»ÊǼ̳нӿڣ¬ÐÐΪ±ØÐëÖØж¨Òå¡£
2 ¼¯ºÍ¶à¼¯µÄÇø±ð£ºsetÖ§³ÖΨ ......