1. ÔÚ¶¨ÒåÊý×éµÄʱºò£¬Êý×éµÄ¸ñʽΪ£ºÊý¾ÝÀàÐÍÊý×éÃû[³¤¶È]£¬ÆäÖ㤶ÈÒªÇóΪÕûÐͳ£Á¿±í´ïʽ£¬ËäÈ»¶à´ÎÇ¿µ÷£¬´ó²¿·ÖѧԱ»¹Êǻ᷸ÒÔϵĴíÎó£º
int main() { int a[]; //¶¨ÒåÊý×éµÄʱºò£¬Êý×éµÄ³¤¶È²»¿ÉÒÔÊ¡ÂÔ£¬¸ÃÖÖ¶¨Ò巽ʽΪ´íÎóµÄ¶¨Ò巽ʽ ...... } |
ÕýÈ·µÄÓ÷¨£º
Èç¹ûÊý×éµÄ³¤¶ÈÊ¡ÂÔ²»Ð´µÄʱºò£¬´ËʱÊý×éÒ»¶¨Òª³õʼ»¯£¬´Ëʱϵͳ»á°´ÕÕÊý×é³õʼ»¯ÁбíµÄÊý¾Ý½øÐзÖÅä¿Õ¼ä£¬µ±È»Ò²²»»á·ÖÅä¶àÓàµÄ¿Õ¼ä£¬Êý×é³õʼ»¯ÁбíÖÐÓжàÉÙ¸öÊý¾Ý£¬¾Í»á·ÖÅä¶àÉÙ¸öÊý¾Ý¶ÔÓ¦µÄ¿Õ¼ä¡£
int main() { int a[] = {1,2,3,4,5,6}; //Ö»ÓÐÔÚ³õʼ»¯µÄʱºò£¬Êý×éµÄ³¤¶È¿ÉÒÔÊ¡ÂÔ²»Ð´ ...... } |
2. ÔÚ¶¨ÒåÊý×éµÄʱºò£¬Êý×éµÄ³¤¶È²»¿ÉÒÔÊDZäÁ¿£¬±ØÐëÊÇÕûÐͳ£Á¿£¬ËùÒÔ²»ÄÜÏȶ¨Òå±äÁ¿£¬È»ºóÔÚ¶¨ÒåÊý×飬ÈçÒÔϵÄÓ÷¨£º
int main() { int n; scanf(¡°%d¡±,&n); int a[n]; //Êý×éµÄ³¤¶ÈΪ±äÁ¿£¬ÔÚcÓïÑÔÖв»ÄÜʹÓøÃÖÖ·½·¨ ...... } |
3. ÔÚʹÓÃÊý×éµÄʱºò£¬Êµ¼ÊÉÏÊÇʹÓÃÊý×éÖеÄÔªËØ£¬Êý×éÒýÓÃÔªËصķ½Ê½ÓÐÊý×éÃû[ϱê]
´ËʱҪעÒ⣬ÔÚʹÓõĹý³ÌÖУ¬²»¿ÉÔ½½ç£¨Ï±겻Äܳ¬¹ý¶¨ÒåÊý×éµÄ³¤¶È£©£¬·ñÔòÓпÉÄܻᵼÖ³ÌÐòÔËÐбÀÀ£