什么奇怪的C语法,这是? [英] What weird C syntax is this?
问题描述
可能显示的文件:结果
<一href=\"http://stackoverflow.com/questions/2633776/c-variable-declarations-after-function-heading-in-definition\">C在定义结果功能标题之后变量声明
什么是这个C语法有用吗?
块引用>我想了解一些C code和跨越这其中,变量函数的头和第一大括号之间声明的来了。
任何想法,这些变量?结果
他们是本地或全球性的?什么是笔者打算在这里做什么?
无效someFunction(m_ptr,n_ptr,则params,ERR)
整数* m_ptr; / *指针点数,以适应* /
整数* n_ptr; / *指针参数个数* /
doublereal * PARAMS; / *的参数向量* /
doublereal *犯错; / *从数据误差向量* /
{
//一些变量这里声明
INT I;
...
... //函数的身体在这里 }
解决方案他们是函数参数。这是声明他们的另一种方式。他们的工作方式一样正常的参数。
有关一个相当长,但非常翔实的解释请参见是什么样的这款C有用语法?
Possible Duplicates:
C variable declarations after function heading in definition
What is useful about this C syntax?I trying to understand some C code and came across this where variables are declared between the head of the function and the first brace.
Any Idea what these variables are?
Are they local or global?What does the author intend to do here?
void someFunction (m_ptr, n_ptr, params, err) integer *m_ptr; /* pointer to number of points to fit */ integer *n_ptr; /* pointer to number of parameters */ doublereal *params; /* vector of parameters */ doublereal *err; /* vector of error from data */ { //some variables declared here int i; ... ... //body of the function here }
解决方案They are function arguments. This is an alternative way to declare them. They work the same way as normal arguments.
For a rather long but very informative explanation see What is useful about this C syntax?
这篇关于什么奇怪的C语法,这是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!