用于计算数组中元素数的标准宏

时间:2017-11-02 01:14:27

标签: c

C标准库中是否有类似的内容:

#define sizeofarr(a)    ( sizeof(a) / sizeof(a[0]) )

2 个答案:

答案 0 :(得分:2)

没有。 C标准库中没有类似的东西。

答案 1 :(得分:2)

不,没有这样的事情!

为了更好的宏定义,请直接检查此链接:

is-there-a-standard-function-in-c-that-would-return-the-length-of-an-array

common-array-length-macro-for-c