Equivalent C declarations

前端 未结 5 1537
南笙
南笙 2021-02-04 20:18

Are

int (*x)[10];

and

int x[10];

equivalent?

According to the \"Clockwise Spiral\" rule, they parse

5条回答
  •  Happy的楠姐
    2021-02-04 20:59

    They are not equal. in the first case x is a pointer to an array of 10 integers, in the second case x is an array of 10 integers.

    The two types are different. You can see they're not the same thing by checking sizeof in the two cases.

提交回复
热议问题