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

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

问题描述

我对C.我遇到函数的语法形式我以前从未见过,其中的参数类型的参数列表后定义相对较新。可以给我一个人解释它是如何比典型的C函数的语法不同?

例如:

  INT主(ARGC,ARGV)
INT ARGC;
的char * ARGV [];
{
返回(0);
}


解决方案

这对参数列表,仍支持老风格的语法。在K&安培; R C,你也可以离开关类型声明,他们将默认为int。即。

 主(ARGC,ARGV)
的char * ARGV [];
{
    返回0;
}

将是相同的功能。

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?

Example:

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

解决方案

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;
}

would be the same function.

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

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