C pointer to array/array of pointers disambiguation

前端 未结 13 1395
我寻月下人不归
我寻月下人不归 2020-11-21 05:19

What is the difference between the following declarations:

int* arr1[8];
int (*arr2)[8];
int *(arr3[8]);

What is the general rule for under

13条回答
  •  时光取名叫无心
    2020-11-21 05:58

    int *a[4]; // Array of 4 pointers to int
    
    int (*a)[4]; //a is a pointer to an integer array of size 4
    
    int (*a[8])[5]; //a is an array of pointers to integer array of size 5 
    

提交回复
热议问题