資源描述:
《C語言指針(指針數(shù)組多級指針動態(tài)指針)課件.ppt》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、元素均為指針類型數(shù)據(jù)的數(shù)組,稱為指針數(shù)組定義形式為:類型關(guān)鍵字*數(shù)組名[數(shù)組長度];例如char*pStr[5];pStr[5]*char四、指針數(shù)組1例main(){inti;charstr[][10]={"Pascal","Basic","Fortran","Java","VisualC"};for(i=0;i<5;i++){printf("%s",str[i]);}}strstr[0]Pascalstr[1]str[2]str[3]BasicFortranJava二維數(shù)組字符串VisualCstr[4]2例main(){inti;char*ptr[]={"Pascal","Basic
2、","Fortran","Java","VisualC"};for(i=0;i<5;i++){printf("%s",ptr[i]);}}ptr[0]Pascalptr[1]ptr[2]ptr[3]BasicFortranJavaptr指針數(shù)組字符串ptrVisualCptr[4]3例:字符串按字典順序排序—二維數(shù)組編程charstr[N][10]={"Pascal","Basic","Fortran","Java","VisualC"};for(i=0;i3、p,str[i]);strcpy(str[i],str[j]);strcpy(str[j],temp);}}}strstrstrstrstrstrstrstrstrstr4例:字符串按字典順序排序—指針數(shù)組編程char*ptr[N]={"Pascal","Basic","Fortran","Java","VisualC"};for(i=0;i