gpt4 book ai didi

c - 如何将 K&R 函数声明自动转换为 ANSI 函数声明?

转载 作者:行者123 更新时间:2023-11-30 17:44:42 24 4
gpt4 key购买 nike

// K&R syntax
int foo(a, p)
int a;
char *p;
{
return 0;
}

// ANSI syntax
int foo(int a, char *p)
{
return 0;
}

如您所见,在 K&R 风格中,变量的类型在新行中声明,而不是在大括号中声明。如何将 K&R 函数声明自动转换为 ANSI 函数声明?有人知道Linux下有这么一个好用的工具吗?

最佳答案

您可以使用cproto或 protoize(GCC 的一部分)以生成函数原型(prototype)或将旧式 (K&R) 函数转换为 ANSI 格式。

关于c - 如何将 K&R 函数声明自动转换为 ANSI 函数声明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19882289/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com