ÈçºÎÀí½âcºÍc++ µÄ¸´ÔÓÀàÐÍÉùÃ÷
Ôø¾Åöµ½¹ýÈÃÄãÃԻ󲻽⡢ÀàËÆÓÚint * (* (*fp1) (int) ) [10];ÕâÑùµÄ±äÁ¿ÉùÃ÷Â𣿱¾ÎĽ«ÓÉÒ×µ½ÄÑ£¬Ò»²½Ò»²½½Ì»áÄãÈçºÎÀí½âÕâÖÖ¸´ÔÓµÄC/C++ÉùÃ÷¡£
¡¡¡¡ÎÒÃǽ«´ÓÿÌ춼ÄÜÅöµ½µÄ½Ï¼òµ¥µÄÉùÃ÷ÈëÊÖ£¬È»ºóÖð²½¼ÓÈëconstÐÞÊηûºÍtypedef£¬»¹Óк¯ÊýÖ¸Õ룬×îºó½éÉÜÒ»¸öÄܹ»ÈÃÄã׼ȷµØÀí½âÈκÎC/C++ÉùÃ÷µÄ“ÓÒ×ó·¨Ôò”¡£
¡¡¡¡ÐèҪǿµ÷һϵÄÊÇ£¬¸´ÔÓµÄC/C++ÉùÃ÷²¢²»ÊǺõıà³Ì·ç¸ñ£»ÎÒÕâÀï½ö½öÊǽÌÄãÈçºÎÈ¥Àí½âÕâЩÉùÃ÷¡£×¢Ò⣺ΪÁ˱£Ö¤Äܹ»ÔÚͬһÐÐÉÏÏÔʾ´úÂëºÍÏà¹Ø×¢ÊÍ£¬±¾ÎÄ×îºÃÔÚÖÁÉÙ1024x768·Ö±æÂʵÄÏÔʾÆ÷ÉÏÔĶÁ¡£
ÈÃÎÒÃÇ´ÓÒ»¸ö·Ç³£¼òµ¥µÄÀý×Ó¿ªÊ¼£¬ÈçÏ£º
int n;
Õâ¸öÓ¦¸Ã±»Àí½âΪ“declare n as an int”£¨nÊÇÒ»¸öintÐ͵ıäÁ¿£©¡£½ÓÏÂÈ¥À´¿´Ò»ÏÂÖ¸Õë±äÁ¿£¬ÈçÏ£º
int *p;
Õâ¸öÓ¦¸Ã±»Àí½âΪ“declare p as an int *”£¨pÊÇÒ»¸öint *Ð͵ıäÁ¿£©£¬»òÕß˵pÊÇÒ»¸öÖ¸ÏòÒ»¸öintÐͱäÁ¿µÄÖ¸Õë¡£ÎÒÏëÔÚÕâÀïÕ¹¿ªÌÖÂÛһϣºÎÒ¾õµÃÔÚÉùÃ÷Ò»¸öÖ¸Õ루»òÒýÓã©ÀàÐ͵ıäÁ¿Ê±£¬×îºÃ½«*£¨»ò&£©Ð´ÔÚ½ô¿¿±äÁ¿Ö®Ç°£¬¶ø²»Êǽô¸ú»ù±¾ÀàÐÍÖ®ºó¡£ÕâÑù¿ÉÒÔ±ÜÃâһЩÀí½âÉϵÄÎóÇø£¬±ÈÈ磺
ÔÙÀ´¿´Ò»¸öÖ¸ÕëµÄÖ¸ÕëµÄÀý×Ó£º
char **argv;
ÀíÂÛÉÏ£¬¶ÔÓÚÖ¸ÕëµÄ¼¶ÊýûÓÐÏÞÖÆ£¬Äã¿ÉÒÔ¶¨ÒåÒ»¸ö¸¡µãÀàÐͱäÁ¿µÄÖ¸ÕëµÄÖ¸ÕëµÄÖ¸ÕëµÄÖ¸Õ룬ÔÙÀ´¿´ÈçϵÄÉùÃ÷£º
int RollNum[30][4];
int (*p)[4]=RollNum;
int *q[5];
ÕâÀp±»ÉùÃ÷Ϊһ¸öÖ¸ÏòÒ»¸ö4ÔªËØ£¨intÀàÐÍ£©Êý×éµÄÖ¸Õ룬¶øq±»ÉùÃ÷Ϊһ¸ö°üº¬5¸öÔªËØ£¨intÀàÐ͵ÄÖ¸Õ룩µÄÊý×é¡£ÁíÍ⣬ÎÒÃÇ»¹¿ÉÒÔÔÚͬһ¸öÉùÃ÷ÖлìºÏʵÓÃ*ºÍ&£¬ÈçÏ£º
int **p1;
// p1 is a pointer to a pointer to an int.
int *&p2;
// p2 is a reference to a pointer to an int.
int &*p3;
// ERROR: Pointer to a reference is illegal.
int &&p4;
// ERROR: Reference to a reference is illegal.
×¢£ºp1ÊÇÒ»¸öintÀàÐ͵ÄÖ¸ÕëµÄÖ¸Õ룻p2ÊÇÒ»¸öintÀàÐ͵ÄÖ¸ÕëµÄÒýÓã»p3ÊÇÒ»¸öintÀàÐÍÒýÓõÄÖ¸Õ루²»ºÏ·¨£¡£©£»p4ÊÇÒ»¸öintÀàÐÍÒýÓõÄÒýÓ㨲»ºÏ·¨£¡£©¡£
constÐÞÊηû
µ±ÄãÏë×èÖ¹Ò»¸ö±äÁ¿±»¸Ä±ä£¬¿ÉÄÜ»áÓõ½const¹Ø¼ü×Ö¡£ÔÚÄã¸øÒ»¸ö±äÁ¿¼ÓÉÏconstÐÞÊηûµÄͬʱ£¬Í¨³£ÐèÒª¶ÔËü½øÐгõʼ»¯£¬ÒòΪÒÔºóµÄÈκÎʱºòÄ㽫ûÓлú»áÔÙÈ¥¸Ä±äËü¡£ÀýÈ磺
const int n=5;
int const m=10;
ÉÏÊöÁ½¸ö±äÁ¿nºÍmÆäʵÊÇͬһÖÖÀàÐ͵ė—¶¼ÊÇconst int£
Ïà¹ØÎĵµ£º
3.3 ¸ßЧÂÊ¿ª·¢
ÕâÒ»½Ú½éÉÜÀûÓõ¥Ôª²âÊÔʵÏÖ¸ßЧÂÊ¿ª·¢¡£µ¥Ôª²âÊÔ¿ÉÒÔÔÚ¼¸¸ö·½ÃæÌá¸ß¿ª·¢Ð§ÂÊ£º²âÊÔÇý¶¯¿ª·¢¡¢¿ÉÊÓ±à³Ì¡¢¿ìËÙÅÅ´í¡¢ºÍÌá¸ßµ÷ÊÔЧÂÊ¡£
²âÊÔÇý¶¯¿ª·¢
Ö¸Ïȱàд²âÊÔ´úÂ룬ȻºóÔÙ±àд²úÆ·´úÂëʹ²âÊÔͨ¹ý£¬ÓкܶàÏà¹ØÎÄÕºÍÊé¼®½éÉÜÕâ·½Ãæ֪ʶ£¬ÏÞÓÚ±à·ù£¬ÕâÀï¾Í²»½²ÁË ......
ÐÞ¸Ämakefile£¬ÔÚLIBSÀïÃæ¼ÓÉÏ-lmemcached£¬±ÈÈçÔÀ´ gcc test.c£¬ÏÖÔÚ gcc test.c -lmemcached¡£Õâ¸ö¿â¾ÍÊÇlibmemcachedÌṩµÄ¡£
È»ºóÌí¼Ó#include<libmemcached/memcached.h>£¬Õâ¸öÎļþÒ²ÊÇlibmemcachedÌṩµÄ¡£
Ö÷º¯ÊýÀïÃæÐèÒªÌí¼Ó£º
memcached_st *memc;
uint32_t&nbs ......
Ò»¡¢ÓÐÈçÏ´úÂ룺
int age = 25;
const int *pAge = &age;
ÉÏÃæµÄ´úÂë±íʾ£º
1¡¢Ö¸Õë±äÁ¿pAge´æ·Å±äÁ¿ageµÄµØÖ·£¬ÇÒ²»ÄÜͨ¹ý *pAge = 30£¬À´¸Ä±äÖ¸Õë±äÁ¿pAgeËùÖ¸ÏòµÄ´æ´¢¿Õ¼äµÄÖµ£¬µ«ÊÇ ¶ÔÓÚ age = 30£¬ÔòÊÇûÓÐÎÊÌâµÄ¡£
2¡¢pAge ±¾Éí¿ÉÒÔÔÙ´æ·ÅÆäËü±äÁ¿µÄµØÖ·£¬Ò²¿ÉÒÔÖ¸ÏòNULL£¬Èç pAge = NULL;ÊÇÕýÈ·µÄ¡£
¶ ......
<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@ËÎÌå" ......
д±¾ÎĵÄÄ¿µÄÊÇΪÁË·½±ã´ó¼ÒÁ˽âC++ MSXML²Ù×÷·½·¨¡£
µ±È»£¬C++ÖжÔMSXMLµÄµ÷ÓÃÓжàÖÖ£¬±¾ÎIJÉÓõķ½·¨ÊÇÍêÈ«²ÎÕÕMSXML SDKÌṩµÄÎĵµ½øÐвÙ×÷¡£
Èç¹ûÓÐʲô´íÎ󣬻¶ÓÖ¸Õý¡£
´úÂë¿ò¼ÜÊÇ»ùÓÚvs2008 MFC ¶Ô»°¿ò³ÌÐò£¨UNICODE£©¡£¶Ô»°¿ò³ÌÐòÐèÒª¶ÁÕß×Ô¼º´´½¨¡£
#include <msxml6.h>
#include <comutil.h>
# ......