C语言 我们可以在函数返回数据类型为 void 的例程中调用函数吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3677264/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 23:31:35  来源:igfitidea点击:

Can we call a function inside a routine where the function return data type is void?

cfunctionvoid

提问by esther

For example, I have:

例如,我有:

void(temperature, pressure,time)
{
    int i;
    double results[10];

    for (i = 0 ; i <= 9 ; i++)  
    {
        fx(temperature, pressure, time);
        results[i]=fx[i];
    }
}

(P/S: above is the simplified version of my real problem) fx by itself is of course another ste of codes with equations for calculations that will give results in fx[i].

(P/S:上面是我的实际问题的简化版本)fx 本身当然是另一个带有计算公式的代码,这些公式将在 fx[i] 中给出结果。

I was just wondering if I can call another function like that in a 'void' function. Just a curious question, Thanks!

我只是想知道我是否可以在“void”函数中调用另一个类似的函数。只是一个好奇的问题,谢谢!

采纳答案by Marcelo Cantos

Yes you can, as long as you give the outer function a name. (This is C, or similar, right?)

是的,你可以,只要你给外部函数一个名字。(这是 C 或类似的,对吗?)

回答by tia

Yes you can, and I am really curious to know why you have this question in your mind because I cannot think of any reason.

是的,你可以,而且我真的很想知道你为什么会想到这个问题,因为我想不出任何原因。