½ÌÄãÀí½â¸´ÔÓµÄC/C++ÉùÃ÷
½ÆäÃ÷ Òë
ÔÎÄ£º
http://www.codeproject.com/cpp/complex_declarations.asp
×÷ÕߣºVikram A Punathambekar
½éÉÜ
Ôø¾Åöµ½¹ýÈÃÄãÃԻ󲻽⡢ÀàËÆÓÚ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ÐͱäÁ¿µÄÖ¸Õë¡£ÎÒÏëÔÚÕâÀïÕ¹¿ªÌÖÂÛһϣºÎÒ¾õµÃÔÚÉùÃ÷Ò»¸öÖ¸Õ루»òÒýÓã©ÀàÐ͵ıäÁ¿Ê±£¬×îºÃ½«*£¨»ò&£©Ð´ÔÚ½ô¿¿±äÁ¿Ö®Ç°£¬¶ø²»Êǽô¸ú»ù±¾ÀàÐÍÖ®ºó¡£ÕâÑù¿ÉÒÔ±ÜÃâһЩÀí½âÉϵÄÎóÇø£¬±ÈÈ磺
int* p,q;
µÚÒ»ÑÛ¿´È¥£¬ºÃÏñÊÇpºÍq¶¼ÊÇint*ÀàÐ͵ģ¬µ«ÊÂʵÉÏ£¬Ö»ÓÐpÊÇÒ»¸öÖ¸Õ룬¶øqÊÇÒ»¸ö×î¼òµ¥µÄ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.&n
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
l Ò»Ö±¶ÔÕâ¿éÄÚÈݶ¼ºÜâðÍ·£¬ÒòΪËü¿´²»µ½Ãþ²»×Å£¬ÎÒÃÇÖ»Äܶ¢×Å×îºó±àÒëÁ´½ÓÖ®ºóµÄ½á¹ûÊdzɹ¦»òÊÇʧ°Ü£¬µ«ÊÇÈ´²»ÖªµÀ±àÒëÆ÷ÄÚ²¿ÊÇÈçºÎ²Ù×÷µÄ£»
l ÿµ±±àÒëÆ÷¸ø³ö´íÎóʱÎÒÃǶ¼Ö»Êǵ¥´¿µÄÈ¥´¦Àí´íÎó£¬È´²»ÖªµÀ±àÒëÆ÷ÊÇÈçºÎÕÒ³öÀ´µÄ£»
......
C/C++ ÈÕÆÚ Ê±¼ä time_tÓëstruct tmת»» ÊÕ²Ø
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬C ......
Ëæ»úÉú³ÉÕûÊý£¬È»ºóËã³öÕý¸ºÁã
void getrand(int *a, int m)
{
int i;
srand(time(NULL));
for (i=0; i<m; i++)
{
a = rand()-rand();
}
}
int main(int argc, char* argv[])
{
  ......
ÔÎĵØÖ·http://www.bc-cn.net/Article/kfyy/cjj/jszl/200602/3702.html
ÒýÑÔ
¡¡¡¡Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀ ......