相关疑难解决方法(0)

我应该声明作为函数参数传递的数组的预期大小吗?

我认为两者都是有效的C语法,但哪个更好?

一个)

void func(int a[]);  // Function prototype
void func(int a[]) { /* ... */ }  // Function definition
Run Code Online (Sandbox Code Playgroud)

要么

B)

#define ARRAY_SIZE 5
void func(int a[ARRAY_SIZE]);  // Function prototype
void func(int a[ARRAY_SIZE]) { /* ... */ }  // Function definition
Run Code Online (Sandbox Code Playgroud)

c

3
推荐指数
2
解决办法
892
查看次数

标签 统计

c ×1