Interpretation of int (*a)[3]

前端 未结 8 1663
别那么骄傲
别那么骄傲 2020-12-07 17:10

When working with arrays and pointers in C, one quickly discovers that they are by no means equivalent although it might seem so at a first glance. I know about the differen

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 17:42

    It declares a pointer to an array of 3 ints.

    The parentheses are necessary as the following declares an array of 3 pointers to int:

    int* a[3];
    

    You get better readability when using typedef:

    typedef int threeInts[3];
    threeInts* pointerToThreeInts;
    

提交回复
热议问题