int main(){ int arr1[] = { 1, 2, 3, 4, 5 }; int arr2[] = { 2, 3, 4, 5, 6 }; int arr3[] = { 3, 4, 5, 6, 7 }; int * parr[] = { arr1, arr2, arr3 }; int i = 0; for ( i = 0; i < 3; i++) { char j = 0; for ( j = 0; j < 5; j++) { printf(" %d", *(parr[i] + j)); //因爲數組存到內存中存的是首元素地址, //因此說存在parr[]指針數組中的arr1~其實都是首元素地址 //指針運算+1, 就能跳到第二個元素中了 parr[1]+1 } printf("\n"); } return 0; } int main() { char a[] = { 1, 2, 3, 4, 5, 6 }; char b[] = { 2, 3, 4, 5, 6, 7 }; char* arr[5] = {a, b}; //arr優先和[5]結合造成數組,類型是char*, //因此說這是個指針數組 //存放指針的數組叫指針數組 //存放數組的指針叫數組指針 char* (*p)[5] = &arr; //(*p)指的是讓*先和P結合變成個指針, //而後解出來與[5]結合造成數組指針.類型是char* int i = 0; for ( i = 0; i < 2; i++) { int j = 0; for ( j = 0; j < 6; j++) { printf("%d", *(*p)[i] + j); } printf("\n"); } return 0; }