gpt4 book ai didi

c - C 中函数的名称

转载 作者:太空宇宙 更新时间:2023-11-04 05:19:26 25 4
gpt4 key购买 nike

我知道这个问题听起来很愚蠢,但请回答。

假设我们有 int A(int num); 作为函数原型(prototype)。

我们将函数名称称为什么? int A(int num) 还是 A

函数体也是定义顶部的部分吗?

int A(int num){        <-- Does the body include this?

return num * num;
}

谢谢。

最佳答案

通常情况下,您只会使用“A”作为函数名称;正如你所说, int A(int num) 是它的原型(prototype);主体是函数的作用,所以这里只是return (num * num);。但是,当在允许重载的语言中引用函数时,您可以使用原型(prototype)而不是名称。

关于c - C 中函数的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18639251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com