1£©Êý×éµÄÉùÃ÷
ÉùÃ÷£º¸æËß
int age;
ÀàÐÍ ±äÁ¿Ãû;
¸ñʽ£ºÊý×éÀàÐÍ Êý×éÃû;
int a[3]; == int [3] a;
ºËÐÄ£º²ÁµôÃû³Æ£¬Ê£ÓàµÄÊÇÀàÐÍ
int a; int ÕûÐÍ
int *p; int * ÀàÐÍÖдø * ÊÇÖ¸ÕëÀàÐÍ
int a[5]; int [5] ÀàÐÍÖдø []ÊÇÊý×éÀàÐÍ
int add(int , int ); int(int,int) ÀàÐÍÖдø ()ÊǺ¯ÊýÀàÐÍ
========================================================
¸ñʽ£º ÔªËØÀàÐÍ Êý×éÃû[ÔªËظöÊý];
Àý£ºint a[3];
int age[5]; ÔªËØÀàÐÍ£ºint ÕûÐÍÊý×é
int * p[5]; ÔªËØÀàÐÍ£ºint * Ö¸ÕëÊý×é
int a[2][4]; ÔªËØÀàÐÍ£ºint [4]Êý×éÊý×é --> ¶þάÊý×é
ÌáÈ¡ÔªËØÀàÐÍ£º²Áµô Êý×éÃû[ÔªËظöÊý]£¬Ê£ÓàµÄ¶¼ÊÇÔªËØÀàÐÍ
×¢Ò⣺
¢Ù¶¨ÒåÊý×éʱ£¬³¤¶È²»ÄÜÊDZäÁ¿£¬ÇÒ²»ÄÜÊÇ¿ÕÖµ
¢ÚÔªËظöÊýÖ»ÄÜÊÇÕûÐͳ£Á¿±í´ïʽ
2£©Êý×éÖØÒª£ºÈçºÎ·ÃÎÊÔªËؿռ䣿
1.Êý×éÃû£ºÊý×éµÄÊ×ÔªËصÄÖ¸Õë
Ê×ÔªËØÖ¸Õë
Ö¸Õë³£Á¿
ÊéÉÏ£ºÊý×éÃûÊÇÊý×éµÄÊ×µØÖ·
2. *a *(a + 1) *(a + 2)
ÌØÊâÔËËã·û: ϱêÔËËã·û
Ö¸Õë [ Æ«ÒÆÁ¿ ] ÓëÊý×éÎÞ¹Ø
³£ÓÃÓÚÊý×é
*a == a[0]
*(a+1) == a[1] µÚ2¸öÔªËØ¿Õ¼ä
3£©.Êý×éµÄ³õʼ»¯
1£©¸ñʽ£º
ÔªËØÀàÐÍ Êý×éÃû[ÔªËظöÊý] ={ÔªËØ1,ÔªËØ2...,ÔªËØn};
2.×¢Ò⣺
¢Ù³õʼ»¯ÁбíÖеÄÊý¾ÝµÄ¸öÊýÓ¦¸ÃÓëÔªËØÊýÄ¿Ïàͬ
¢Úÿ¸öÊý¾ÝÖ®¼äʹÓöººÅ¼ä¸ô
¢ÛÕûÌåʹÓà { } µÄÁбíÐÎʽ
{ } Ö»Óгõʼ»¯Ê±£¬¿ÉÒÔʹÓ㬱íʾÕûÌåµÄÒâ˼
------------------------------
3. ¢Ù³õʼ»¯ÁбíÖÐÊý¾ÝµÄ¸öÊý СÓÚ ÔªËØÊýÄ¿
Àý£ºint a[4] = {12, 34};
¢Ú³õʼ»¯ÁбíÖÐÊý¾ÝµÄ¸öÊý ´óÓÚ ÔªËØÊýÄ¿
int a[4] = {12,34,56,78,45};
±àÒ뱨´í
¢Ûδָ¶¨ÔªËØÊýÄ¿µÄ³õʼ»¯
int a[ ] = {12, 34, 56};
±àÒëÆ÷»á¸ù¾ÝÁбíÖÐÊý¾ÝµÄ¸öÊý£¬ ÒÔ¼° ÔªËصÄÀàÐÍÀ´µÃµ½ÔªËصÄÊýÄ¿