问题描述
我正在谈论Scilab C包装程序的示例: http://www.scilab.org/doc/intro/node89.html .
I'am talking about this example of a Scilab<->C wrapper: http://www.scilab.org/doc/intro/node89.html.
奇怪的是这个部分:
int intsfoubare(fname)
char *fname;
{
....(some code)
}
这是某种函数定义,但是我真的不明白char * fname有什么用,因为fname对我来说毫无意义.
It is some kind of function defintion but I really don't understand what the char *fname is good for also just fname as parameter makes no sense to me.
有人可以解释吗?
[开始哭泣]一般来说,Scilabs文档是一个负面的例子,但是当涉及到C接口时,情况甚至更糟.[哭完]
[start crying]Scilabs documentation in general is a negative example but when it comes to the C-interface it's even worse.[end crying]
谢谢!
推荐答案
我相信您正在寻找的是K& R样式的函数声明.它大约等效于 int intsfoubare(char * fname){...}
,但是在调用该函数时具有更大的灵活性.有关更多详细信息,请参见这篇文章.
I believe what you're looking at is the K&R style of function declaration. It's approximately equivalent to int intsfoubare(char *fname) { ... }
, but allows more somewhat more flexibility in calling the function. See this post for more details.
这篇关于Scilab-C接口中的奇怪函数定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!