Interpretation of int (*a)[3]

前端 未结 8 1640
别那么骄傲
别那么骄傲 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:41

    Every time you have doubts with complex declarations, you can use the cdecl tool in Unix like systems:

    [/tmp]$ cdecl
    Type `help' or `?' for help
    cdecl> explain int (*a)[10];
    declare a as pointer to array 10 of int
    

    EDIT:

    There is also a online version of this tool available here.

    Thanks to Tiberiu Ana and gf

提交回复
热议问题