C函数语法,参数列表后声明的参数类型 [英] C function syntax, parameter types declared after parameter list

查看:38
本文介绍了C函数语法,参数列表后声明的参数类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 C 比较陌生.我遇到了一种我以前从未见过的函数语法形式,其中参数类型在参数列表之后定义.有人可以向我解释一下它与典型的 C 函数语法有何不同吗?

I'm relatively new to C. I've come across a form of function syntax I've never seen before, where the parameter types are defined after that parameter list. Can someone explain to me how it is different than the typical C function syntax?

示例:

int main (argc, argv)
int argc;
char *argv[];
{
return(0);
}

推荐答案

这是参数列表的旧式语法,仍然受支持.在 K&R C 中,您也可以省略类型声明,它们将默认为 int.即

That's the old-style syntax for parameter lists, which is still supported. In K&R C you could also leave off the type declarations and they would default to int. i.e.

main(argc, argv)
char *argv[];
{
    return 0;
}

将是相同的功能.

这篇关于C函数语法,参数列表后声明的参数类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆