Difference between two declarations involving a pointer and an array

后端 未结 6 1239
臣服心动
臣服心动 2020-12-18 11:45

What is the difference between int *a[3] and int (*a)[3]?

6条回答
  •  借酒劲吻你
    2020-12-18 12:07

    Alternatively, you can use cdecl, which outputs the meaning of variable declarations in English.

    cdecl> explain int*a[3]
    

    declare a as array 3 of pointer to int

    cdecl> explain int (*a) [3]
    

    declare a as pointer to array 3 of int

提交回复
热议问题